Double clicking file loads it in existing window

Blitz3D Forums/Blitz3D Beginners Area/Double clicking file loads it in existing window

Dock(Posted 2005) [#1]
I was wondering whether it was possible in a Blitz program to load files into the existing application, rather than creating another instance. In fact I'd like to avoid multiple instances at all costs.

If the program isn't open, double-clicking the data file (with the right extension, say file.ext) will launch my program and load the file in there.

If the program *IS* open, I don't want another session making, but rather the new file to completely replace the existing one.

Is this possible?


Dock(Posted 2005) [#2]
Hmm, no-one seems to know the answer to this. :(

I'm wondering whether any existing Blitz programs avoid opening a second instance already. I'm starting to think that it's not possible.

Might it be likely that BlitzPlus would be more friendly to this sort of thing?


jfk EO-11110(Posted 2005) [#3]
It would be possible when you cheat a bit. First of all your App needs to be associated with the filetype you want to be able to doubleclick. If this once works, you could do the following:
Use the windows Api (FindWindow I guess) to see if your Tool is already running (Using Apptititle to recognize it). If the tool is already running, write a special command to the clipboard. Something like
Myapp:magic31415926-1.2.3.5.8.13.21/open>>path\test.mp3<<

In the same time the tool that is already running will check the clipboard frequently. If it detects some special command (likethis example containing a magic key code and a access path etc.) it will open the test.mp3 file, then it will erase the clipboard.
The second app process, that didn't really open the tool and the test.mp3 file then simply exits.

Well this is the way I would try it, tho it's kind of a hack.