PDA

Click to See Complete Forum and Search --> : Filling the first word of the buffer


JoshT
Oct 2nd, 2001, 02:35 PM
MSDN says to use the EM_GETLINE message to get the text of an edit, you have to "set the first word of this buffer to the size, in TCHARs, of the buffer". It seems to work without doing so, but am I doing this right?

int length = 0;
char * pchText = NULL;
WORD mp = (WORD)MAX_PATH; \\???

pchText = (CHAR*)HeapAlloc(GetProcessHeap(), 0, MAX_PATH);
CopyMemory(pchText, &mp, sizeof(WORD)); \\???
length = SendMessage(g_hSource, EM_GETLINE, 0, (LPARAM)pchText);
pchText[length+1] = '\0';
MessageBox(0, pchText, "test", MB_OK);
HeapFree(GetProcessHeap(), 0, pchText);

Thanks.

CornedBee
Oct 2nd, 2001, 04:35 PM
Yeah, this is right. I don't know about intel byte order, butI think windows can handle this.

JoshT
Oct 3rd, 2001, 06:35 AM
Ok, thanks.