How to send keystrokes to different windows

Hi everyone,

I don't understand how to send keystrokes to different windows. I've got to the point I manually have to click each window but it defeats the point.

1
2
3
4
5
6
7
8
9
10
11
Sleep(5000); // Click on window I
keybd_event(VK_LSHIFT,0xa0,0, 0);
keybd_event(VkKeyScan('R'),0x93,0, 0); 
keybd_event(VkKeyScan('R'),0x93, KEYEVENTF_KEYUP,0);
keybd_event(VK_LSHIFT,0xa0,KEYEVENTF_KEYUP,0);

Sleep(2000); // Click on window II
keybd_event(VK_LSHIFT,0xa0,0, 0);
keybd_event(VkKeyScan('R'),0x93,0, 0); 
keybd_event(VkKeyScan('R'),0x93, KEYEVENTF_KEYUP,0);
keybd_event(VK_LSHIFT,0xa0,KEYEVENTF_KEYUP,0);


I put in the following to see what the titles were but I don't understand setfocus() or HWND. Is there anywhere this is explained properly?

1
2
3
4
	    char con[164];
	    GetConsoleTitle(con,sizeof(con));
	    HWND hwndConsole = FindWindow(NULL,con);
	    EnumWindows(SearchProc, NULL);


Many thanks,
Lloyd
Topic archived. No new replies allowed.