what happends when I drop a file onto a desktop icon?

Hello, I have a wx application and I want to launch it and load a file when a user drops the file over my applications desktop icon. what happens when I do this? I imagine that there is maybe an event posted or else some data is passed to the parent frame of the application to give the path to the file that was dropped over the icon? thanks.

Jeff

···

Do you Yahoo!?

Get on board. You’re invited to try the new Yahoo! Mail Beta.

Jeff Peery wrote:

Hello, I have a wx application and I want to launch it and load a file when a user drops the file over my applications desktop icon. what happens when I do this? I imagine that there is maybe an event posted or else some data is passed to the parent frame of the application to give the path to the file that was dropped over the icon? thanks.

For Windows and most window managers on *nix, you'll get the dropped file(s) on the command line of a newly started instance of your app. If you want to have only one instance of your app running then you can use wx.SingleInstanceChecker to help detect the situation and then some sort of IPC to pass the new file(s) to the currently running instance of your app if there is one.

On Mac the system will send an AppleEvent to the app with the dropped file names. In wx you can catch these events by overriding a special method of the wx.App class: MacOpenFile(self, filename)

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!