views:

81

answers:

1

I have a WxPython app that, among other things, has a integrated file-browser.

I want to be able to create a system-default file context menu (e.g. what you get if you right-click on a file in windows explorer) when a user right clicks on one of the items within my application.

Note: I already know how to create my own context menu (e.g. wx.EVT_LIST_ITEM_RIGHT_CLICK), I want the Windows context menu.

To clarify, I do not want, or need to modify the existing system context menu, I want to be able to display it for a specific file within my application.

Basically, I know what was right clicked on, and where the mouse pointer is (if it's needed). I want to create the system context menu there, just like it works in windows explorer.

A: 

If you have python win32 installed, then look under the directory <PYTHON>/lib/site-packages/win32comext/shell/demos/servers. This contains a file context_menu.py which has sample code for creating a shell extension.

Update: I think you want the folder_view.py sample.

ars
This is not what I want to do. I don't want to modify the system context menu, I want to **display** it *within* **my** application.
Fake Name
Does this correspond to the `SHCreateDefaultContextMenu` API in win32? If so, I think you want `folder_view.py`. At any rate, there are plenty of samples in the directory I pointed to in my answer. One of them might be helpful to you.
ars
I don't think so. All the examples in `win32comext/shell/demos/servers` seem to pertain to adding additional behaviors to the windows shell.
Fake Name
Also, `folder_view.py` is vista and 7 only (I think).
Fake Name
Hmm. That's too bad, sorry I can't help more. I'll update the answer if something occurs to me.
ars
Unsure if this is possible - if you'd show the Windows menu then how would you bind your events to each menu item?
Steven Sproat
It has to be possible, because it's done in many applications.As for handling menu events, I don't think any of them need to be handled within the application. They're all things you'd call the windows API for anyways.
Fake Name