Quote Originally Posted by bushmobile
if you find the ID of the menu you want to press then the SendMessage will just be a single line:
VB Code:
  1. SendMessage thehWnd, WM_COMMAND, theID, 0&
If you want to send an Alt+P i guess you'll have to use WM_KEYDOWN and then WM_KEYUP - check out the virtual key constants of the keys too. Alt will be VK_ALT or something like that.
I've tried this to get the menu id with no success (nothing happens):
VB Code:
  1. '...after shelling MyApp:
  2.         hWnd= FindWindow(vbNullString, "MyAppName")
  3.         hmnu = GetMenu(hWnd)
  4.         hsbmnu = GetSubMenu(hMenu, 0)
  5.         SendMessage hWnd, WM_COMMAND, hsbmnu, 0&
... I am sort of groping in the API...