Starting program from file select

Hello,

Created a program in Xojo / Build the program / Made an msi installer with advanced installer / Installed in windows on my PC.
The program works with midi files (.mid).
If in windows I set that double clicking on a .mid file the program should start -> This works.
If I now doubleclick another .mid file it is not loaded into the already opened session of my program, but a new session is opened.

How can that be changed ? I don’t think it is in my Xojo program !
Does this need to be done somewhere in the advanced installer by creating the .msi file ?
Has someone an idea or a solution for this problem ?

Thanks
Regatrds
Etienne

This is not something that happens automatically. When you double click the file, a new instance of your program will always be executed. Your app needs to detect that another instance of itself is already running, for example by using a Mutex, and then give the file info to the already-running app (e.g. via a IPCSocket.)

[quote=353994:@Volbragt Etienne]If I now doubleclick another .mid file it is not loaded into the already opened session of my program, but a new session is opened.
[/quote]
That’s standard behavior on Windows.

[quote]
How can that be changed ?[/quote]
This seems like odd behavior for a Windows app. Why do you need them to be in the same session? Shouldn’t they be independent of each other in separate windows?

Thanks Andrew and Tim for your reply.
I will take a look into Mutex …

@Tim Hare

They must not be at the same time in the same session. The second must replace the first file.
For example :
Windows media player does not open another session by selecting another mp3 or Wav or …
It stops playing the old file and start playing the new one.

Regards
Etienne

Ah, I see. I was thinking of an editor, not a player. Carry on.

Ok Tim.
No problem.
Thanks.