Click here to Skip to main content
15,887,596 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
We all know that pressing the windows button in the keyboard opens the start menu. lets suppose I want to write a code which does the same when I execute that program, instead of actually touching the keyboard. If its possible, can you direct me in the right direction? I am trying to achieve the same using C++.

What I have tried:

I am unable to find any proper explanation online that might help.
Posted
Updated 18-Oct-17 8:35am

1 solution

Call this: MSDN: keybd_event function[^] Pass it two virtual key down codes: CTRL, and then ESC. Then pass it two virtual key up codes: ESC and then CTRL

There is a link to the Virtual key codes in the link, as well as a basic example.
 
Share this answer
 
v2
Comments
Roger1990 18-Oct-17 15:20pm    
Thanks
Roger1990 21-Nov-17 15:03pm    
The keybd_event function takes the following arguments:

VOID WINAPI keybd_event(
_In_ BYTE bVk,
_In_ BYTE bScan,
_In_ DWORD dwFlags,
_In_ ULONG_PTR dwExtraInfo
);

I noticed that there are scan codes for Letters like W but no virtual key code. How can make those events happen using keybd_event?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900