Click to See Complete Forum and Search --> : SendMessage problem


Brenton S.
March 23rd, 2006, 03:39 PM
In the "New Message" dialog of Outlook Express, there is a rich edit control in which the user types the recipient's name. I'm am trying to set the text of the control by using the following code:

HWND hwndOutlook;
HWND hwndTo;
CHAR szTo[] = "name@domain.com (name@domain.com)";

hwndOutlook = FindWindow("ATH_Note", "New Message"); // Get a handle to the New Message wnd

hwndTo = FindWindowEx(FindWindowEx(hwndOutlook, NULL, "OE_Envelope", NULL), NULL, "RichEdit20W", NULL); // Get a handle to the rich edit control

SendMessage(hwndTo, WM_SETTEXT, 0, (LPARAM)szTo); // Set the text of the rich edit control to szTo


But, the richedit control is not recieving the message. :confused:

Does anyone know what the problem is?

kkez
March 24th, 2006, 09:10 AM
Check if the handle that FindWindow/FindWindowEx return is not NULL, before trying to use it with SendMessage/FindWindowEx.

logan
March 24th, 2006, 09:40 AM
That control doesn't seem to be a richedit control. Spy++ shows it class as Internet Explorer_Server.

Brenton S.
March 24th, 2006, 10:14 AM
I checked the handle and it was not NULL.

In response to logan:


That control doesn't seem to be a richedit control. Spy++ shows it class as Internet Explorer_Server.

I'm talking about the rich edit control next to "To:"