Mega Code Archive

 
Categories / Delphi / Examples
 

How to open a menu-item from your application

You can do this by sending keystrokes to your application using keybd_event. E.g. to open the "File" menu, you need to send "Alt-F": keybd_event(VK_MENU, MapVirtualkey(VK_MENU, 0 ), 0, 0); keybd_event(Ord('F'), MapVirtualKey(Ord('F'), 0), 0, 0); keybd_event(Ord('F'), MapVirtualKey(Ord('F'), 0), KEYEVENTF_KEYUP, 0); keybd_event(VK_MENU, MapVirtualkey(VK_MENU, 0 ), KEYEVENTF_KEYUP, 0);