PDA

View Full Version : Run application by opening file



rivci
26th February 2011, 01:44
I don't really know how to explain this..

I use windows 7 platform
I make an application whose output is a file (consider *.asd). What I want to do is, if I double click this file, my application will run and open this file.

To simplify, I want to make my application's behavior like *.xls in microsoft excel. When I open *.xls file, microsoft excel automatically run and open this file.

Anyone got any suggestions?

Sorry for poor english :)

SixDegrees
26th February 2011, 04:33
This is a Windows issue, not a Qt issue. You need to register the file extension and associate it with the executable to be run when a file with that extension is double-clicked.

I don't recall the exact steps, but basically you right-click a file and select "open", which will bring up an error dialog and give you a choice to select an application to run the file with and whether you want that association to be permanent.

rivci
2nd March 2011, 02:25
Done, when I double click the file, my application runs.

But my file's data is not loaded.. how should I pass this file to my application?

squidge
2nd March 2011, 07:54
That depends on how you configured the OS to pass the filename to your application when you created the association. Did you request the filename as part of the command line parameters, or as a DDE request? The second is typically done so that if your application is already running another copy is not started, but rather you are sent a message detailing the file open request.