harpo
10-10-2009, 07:59 AM
Hi,
I have a VB6 app for which I want to ensure that only one instance is running. For this purpose, in Form_Initialize() of the startup form I have
If App.PrevInstance Then End
But this app is also integrated with WindowsExplorer, that is you may right click a file and select 'Open in myapp', which sends a command like
myapp.exe -sh<filepath> to it - in this case, if there is an opened instance, nothing happens as the newly started one dies immediately.
Is it possible to combine both? To have only one instance, which somehow catches commands sent to the .exe ?
What comes to mind is to write the command to a file or registry before End, and to regularly check for this file/registry, read and delete it when it appears. But there should be a more elegant way than regular checks.
Thanks for any suggestions
I have a VB6 app for which I want to ensure that only one instance is running. For this purpose, in Form_Initialize() of the startup form I have
If App.PrevInstance Then End
But this app is also integrated with WindowsExplorer, that is you may right click a file and select 'Open in myapp', which sends a command like
myapp.exe -sh<filepath> to it - in this case, if there is an opened instance, nothing happens as the newly started one dies immediately.
Is it possible to combine both? To have only one instance, which somehow catches commands sent to the .exe ?
What comes to mind is to write the command to a file or registry before End, and to regularly check for this file/registry, read and delete it when it appears. But there should be a more elegant way than regular checks.
Thanks for any suggestions