Possible Duplicate:
Using SendMessage to enter text into an edit control belonging to another process
I want to set up text in edit control of directx window programatically. I can get correct handle of edit control, but text is inserted only if I click on Edit control, How can insert text without clicking on Edit control. I'm doing this:
HWND hWnd = FindWindow(NULL,"Game");
HWND edit = FindWindowEx(hWnd, NULL, "Edit", NULL);
SendMessage(edit, WM_CHAR, (TCHAR) 'H', 0);
Sleep(100);
SendMessage(edit, WM_CHAR, (TCHAR) 'E', 0);
Sleep(100);
SendMessage(edit, WM_CHAR, (TCHAR) 'L', 0);
Sleep(100);
SendMessage(edit, WM_CHAR, (TCHAR) 'L', 0);
Sleep(100);
SendMessage(edit, WM_CHAR, (TCHAR) 'O', 0);
Sleep(100);
Parent window hides/disables the edit control when I move away from edit control.
this code is working only if I click Edit control at same time when code running.... but how to make it programatically and full automated to insert text without clicking on Edit control. It is possible to do this all in background?