Hi,
I’m trying to accomplish roughly the same thing as MacOpenFile does on the Mac, but on Windows.
For those unfamiliar, let me explain. I want it so that if someone double-clicks on one of my document files, it will either:
-
If no other copy of the app is running, it will start up the application and open the document.
-
If another copy of the app is running, it will just tell that already-running copy to open the document.
Another way to put it: I’d like to work like Visual Studio works on Windows: opening a .c file from the file explorer doesn’t open a separate copy of visual studio.
I’m using py2exe to create an application from my wxPython code.
Sorry if there’s a simple way to do this, but I’ve been unable to find it.
-
My best idea so far is to use the wx.SingleInstanceChecker. With it, I can prevent the second copy of the app from starting up, but I can’t communicate with it to tell it which documents to open. I could use an out of band communication method (TCP sockets, a file, …), but that seems very kludgy.
-
I saw references elsewhere to using DDE on Windows. Unfortunately, I’m not a DDE expert and there appears to be very little documentation in the context of python. …also, the wxwidgets DDE class doesn’t appear to be supported on wxpython (unless I missed it), so I’d have to mix in win32 calls. Ick.
-
The pydocview stuff looks like it might be usable, though again I don’t see any docs for it (and one piece of sample code that doesn’t quite do what I want).
Thanks!
-Doug