Open Windows’s Start menu

Open Windows’s Start menu

By simulating the pressing of the “Windows” menu – or better yet, of the Ctrl-Escape key combination, which also works on older keyboards – you can programmatically bring up the Start menu. You can’t use the SendKeys function to do so, though, and you have to resort to the keybd_event API function:

Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, _    ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)Private Const KEYEVENTF_KEYUP = &H2' Press the Ctrl-Esc keykeybd_event vbKeyControl, 0, 0, 0keybd_event vbKeyEscape, 0, 0, 0DoEvents' Release the two keyskeybd_event vbKeyControl, 0, KEYEVENTF_KEYUP, 0keybd_event vbKeyEscape, 0, KEYEVENTF_KEYUP, 0DoEvents


Share the Post: