|
From: Tom C. <tho...@ya...> - 2004-04-21 09:05:20
|
hi there,
i'm trying to write a window program to send keyboard input to notepad,
but notepad won't be able to accept the input. can anyone point to me as
what's wrong with the following piece of code?
#include <windows.h>
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow)
{
HWND hAppWnd;
if ((hAppWnd = FindWindow(NULL, "Untitled - Notepad"))!=NULL) {
MessageBox(NULL, "Send a MSG to NotePad", NULL, MB_OK);
// SendMessage(hAppWnd, WM_DESTROY, NULL, NULL); // this line works
fine
SendMessage(hAppWnd, WM_CHAR, 65, NULL); // send a "A" character
} else {
MessageBox(NULL, "Can't get notepad handle", NULL, MB_OK );
}
return 0;
}
TIA!
please reply to tho...@ya...
---------------------------------
Do you Yahoo!?
Yahoo! Photos: High-quality 4x6 digital prints for 25¢ |