I just can't get it to work... can anyone tell me the code they would use to send a key to something like notepad and have it read it as if it were you hitting a key on the keyboard?:confused:
Printable View
I just can't get it to work... can anyone tell me the code they would use to send a key to something like notepad and have it read it as if it were you hitting a key on the keyboard?:confused:
Like this -
Code:#include <windows.h>
int main()
{
HWND hwnd=0;
//Get main notepad handle
while(hwnd==0)
hwnd = FindWindow("Notepad",0);
HWND hwndEdit =0;
//Get notepad edit control
while(hwndEdit==0)
hwndEdit = FindWindowEx(hwnd,0,"edit",0);
//write an 'a'
TCHAR test = 'a';
SendMessage(hwndEdit,WM_CHAR,test,0);
return 0;
}
It worked!! Thank you so much!:)