Andrew Truckle
April 12th, 1999, 01:06 AM
In a previous query, someone gave me the following idea:
******************************
In the thread you can send the message using something like:
CString sendstring = _T("Send this text");
char *lpszPostedBytes = (char *) LocalAlloc(LPTR,sendstring.Length() + 1);
if (lpszPostedBytes != NULL)
{
strcpy(lpszPostedBytes, (LPCTSTR) sendstring);
PostMessage(myWnd, YOUR_MESSAGE, (LPARAM) lpszPostedBytes, 0L);
}
Then release the memory when the message been processed using:
LocalFree();
******************************
I've implemented this with only one problem. I don't know where, or when to release the memory using LocalFree().
If I do it after calling ::PostMessage(), it frees the memory before processing the message. So what do I do!!!!
******************************
In the thread you can send the message using something like:
CString sendstring = _T("Send this text");
char *lpszPostedBytes = (char *) LocalAlloc(LPTR,sendstring.Length() + 1);
if (lpszPostedBytes != NULL)
{
strcpy(lpszPostedBytes, (LPCTSTR) sendstring);
PostMessage(myWnd, YOUR_MESSAGE, (LPARAM) lpszPostedBytes, 0L);
}
Then release the memory when the message been processed using:
LocalFree();
******************************
I've implemented this with only one problem. I don't know where, or when to release the memory using LocalFree().
If I do it after calling ::PostMessage(), it frees the memory before processing the message. So what do I do!!!!