SendMessage for keystroke is not working

P

poirepoisson

Guest
Hi all



could you please tell me why this code does not work? It should simulate the pression of TAB and then arrow DOWN, but nothing happens. I´m sure I have the right handle to the window, because I can click with the mouse on some of its buttons.




SetForegroundWindow(hwndWindow);

SetActiveWindow(hwndWindow);

SetFocus(hwndWindow);


SendMessage(hwndWindow, WM_SETFOCUS, VK_TAB, 0); //tried also without

SendMessage(hwndWindow, WM_SETFOCUS, VK_TAB, 0); //these 2 messages

Sleep(500);

SendMessage(hwndWindow, WM_KEYDOWN, VK_TAB, 0);

SendMessage(hwndWindow, WM_KEYUP, VK_TAB, 0);

Sleep(1000);

SendMessage(hwndWindow, WM_KEYDOWN, VK_DOWN, 0);

SendMessage(hwndWindow, WM_KEYUP, VK_DOWN, 0);





Many thanks in advance



Fede​

Continue reading...
 
Top Bottom