I'm currently coding on a project where I need to post a user-defined message together with a LPCWSTR parameter. But I don't know how to achieve that coz you know, PostMessage() only provides parameters typed as WPARAM and LPARAM. Anyone could help? Many thx in advance.
Krauze
Posts
-
application messaging -
a weird behaviorYes, they turned out to be the same. BTW, I reckon I need use wchar_t instead of TCHAR......as you said... anyways, thank you all the same
-
a weird behaviorI've got the following file header structure with every field ending by '\0':
struct CF_HEADER
{
TCHAR strIdentifier[7]; // "XXXXXX"
TCHAR bHasPath[2];
TCHAR bOrder[2];
TCHAR nTime[4];
TCHAR nEffect[2];
TCHAR nNum[3];
TCHAR nPos[3];
};Then I initialized a UNICODE .txt file with this header. And in the file the following can be seen by Notepad:
XXXXXX 0 0 000 0 00 00
Of course there're times when these data should be updated. One of these functions to update the bOrder field is like this:
CF_HEADER m_cfhdInfo;
CFile file;
... // some other functions and reading the header into m_cfhdInfo
void SetOrder(BOOL bOrder)
{
_itot_s(bOrder, &m_cfhdInfo.bOrder[0], sizeof(TCHAR), 10);updateHeader();
}
void updateHeader()
{
file.Seek(2, CFile::begin); // never overwrites 0xFEFF
file.Write(&m_cfhdInfo, sizeof(CF_HEADER));
}When I called SetOrder(TRUE), things proved weird. The following data can be seen in the file by Notepad:
XXXXXX 01 000 0 00 00
However, I had expected the results like this:
XXXXXX 0 1 000 0 00 00
Anyone could help? Thanks in advance.
-
resizing a dialogI'm coding with VC++ 2008 and I've got a dialog with none border. Now I wanna resize it in some other message handlers, such as BTN_CLICKED, than CDialog::InitDialog(), using CWnd::MoveWindow(). But it won't work. So anyone could help? Many thanks in advance.
-
MoveWindow()Under what circumstances will this function not work? I mean using it to change the width of the window. I find it kinda weird that this function sometimes works but sometimes not. Anyone could help? Many thx!
-
LPSTR or something like thatmany thx
-
LPSTR or something like thatthx for your detailed example
-
LPSTR or something like thatthx a lot
-
LPSTR or something like thatvoid getPath(LPSTR lpszPath)
{
CFile file;
char pbuf[512];
...
file.Read(pbuf, size);
// here I wanna copy the first n chars of pbuf into lpszPath
}So what can I do to manage it? Maybe what has confused me is the different string data types....
-
IKnownFolderMy current project needs to be supported by IKnownFolder. But I've never programmed with this kind of interfaces. So anyone could help? I'll really appreciate it if you could give some links or codes on what files should be introduced in and how and the initialization codes. Thanks in advance.
-
how to simultaneously show 2 dialogsI'm now coding with VC++2008. I wanna show 2 dialogs at the same time. So how to achieve it? Thanks in advance. In fact I've tried the following:
BOOL CDlg1::OnInitDialog()
{
...
dlg2.Create(IDD_DIALOG2, this); // where dlg2 is defined as a private CDlg2 varibale of CDlg1 in its header file
dlg2.ShowWindow(SW_SHOW);
...
}But this doesn't work.
-
WM_PAINT [modified]Thank y'all!
-
WM_PAINT [modified]In fact there're up to 30,000 coordinates. So it's kinda terrible to store all of them in a particular structure at runtime.
-
WM_PAINT [modified]I'm coding a plotting app using coordinates data saved in a .txt file. So I need access files in CDialog::OnPaint(). But it seems not to work coz I find the file pointer doesn't move though CFile::Seek() and CFile::Read() are used. Or could a while loop be in CDialog::OnPaint()?
modified on Tuesday, September 7, 2010 10:46 PM
-
prob with coordinatesthx a lot
-
prob with coordinatesthx a lot!
-
prob with coordinatesI'm coding with VC++2008. When designing the layout of the controls in the .rc file, we can see their coordinates in the bottomright of the screen. And now I have a control with (4,30) shown there and another one with (5,156). Then I wanna draw a line between these 2 controls using the coordinates by GDI.
pDC->MoveTo(4,30); pDC->LineTo(5,156);
But at runtime, the line doesn't correspond to those coordinates. I mean there is a big offset from the expected position. What's wrong? Thx in advance.
-
how to read a file continuously using CFileThx a lot.
-
how to read a file continuously using CFileyep! In fact I wanna plot a range of x- and y-coordinates onto a graph while reading them in a txt file. So I used "continuously".
-
how to read a file continuously using CFilePersonally, it'd be like the following:
char str\[3\]; CFile file; .... // other preliminary codes before reading it while( !EOF() ) { file.Read( &str, 3 ); } file.Close();
But IDK how to write the codes for "!EOF()". Or any other ways to read files continuously? Thx in advance! PS: .txt files