PDA

View Full Version : Open multiple files with one program instance



Ginsengelf
16th March 2009, 12:32
Hi, I want to select multiple files in Windows explorer and open them (by pressing Enter) with the same program instance.
For now I can open one file this way, but if I select multiple files, I get the same number of instances of my program, and each of these instances opens one file.

Is there a way to achieve the "all files - one instance" goal with Qt mechanisms, or do I have to use a native API?
If the latter, any ideas for what I'd have to search? A short search brought "dde" up, is this right?

Thanks in advance,

Ginsengelf

spirit
16th March 2009, 12:41
maybe I didn't understand properly what you need, but did you see QFileDialog::getOpenFileNames method?

Lykurg
16th March 2009, 12:43
Have a look at QtSingeApplication (http://www.qtsoftware.com/products/appdev/add-on-products/catalog/3/Utilities/qtsingleapplication) and the article at the wiki (I think there was one...)

olidem
16th March 2009, 12:45
I don't know the exact solution, but generally your problem splits in two sub problems:

A) Only open ine instance of your program at a time

B) give an open instance of you program an external command to open a certain file

DDE sounds good, I used this with Latex some time ago...

Ginsengelf
16th March 2009, 12:53
Have a look at QtSingeApplication (http://www.qtsoftware.com/products/appdev/add-on-products/catalog/3/Utilities/qtsingleapplication) and the article at the wiki (I this there was one...)

Amazing reaction time :)

The QtSingleApplication looks like something I can use, thanks. In the wiki there's an just article about the Singleton pattern (or maybe I missed the correct one).

Ginsengelf

Lykurg
16th March 2009, 13:18
(or maybe I missed the correct one).

short answer: yes! :p

Long answer: Look here: Data_Sharing (http://wiki.qtcentre.org/index.php?title=Data_Sharing) and SingleApplication (http://wiki.qtcentre.org/index.php?title=SingleApplication)


Lykurg

Ginsengelf
16th March 2009, 14:08
Indeed...:eek: it is listed under "Categories -> Tutorials" on the left, but I just looked over the wiki main page where it is not listed :confused: