What's new
Visual Studio.Net Help Community

A community to get Microsoft Visual Studio.Net programming help.

Visual Studio.Net Help Community is a community for .Net programmers to interact with people who want to learn to program using the Microsoft Visual Studio.Net languages or who program using the Microsoft .Net languages and want to share their .Net knowledge.

Visual Studio.Net Help Community is a free programmer help site so why not join the community today? Once you are a member you get access to all our .Net programming discussions.

SendMessage for keystroke is not working

P

poirepoisson

#1
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