When you click the right mouse button on your clean desktop it opens a context menu. Each item there is a call to a method. To programmatically call those methods, first I need to know which one I want. IIRC there is a tool that helps with that, but I can't remember its name.
+2
A:
You cannot call such a method in another process. You could try to inject the WM_COMMAND message that a context menu usually generates with SendMessage. Use Spy++ to find out what that message might be, if it exists.
Hans Passant
2010-08-26 17:05:06
It is impossible to use Spy++ drag'n'drop feature on context menus, because they close before when you try to use this tool
Jader Dias
2010-08-28 18:06:14
You want to spy on the window on which the menu is displayed. That's the one that gets the command.
Hans Passant
2010-08-28 18:08:45
+1
A:
Use Spy++ to find the handle and use SendMessage / PostMessage. It will be something similar to:
hwnd = FindWindow(...)
hmenu = GetMenu(hwnd)
hsubmenu = GetSubMenu(hmenu, 0)
menuid = GetMenuItem(hsubmenu, 1)
SendMessage(hwnd, WM_COMMAND, menuid, 0)
Adrian Cantu
2010-08-26 17:10:58