PJ,
It's a little complicated, but it is possible. First, you would need
to create a remoting server in your application, such that the application
that is the only one running would be the one that is the server. This
would have a method which would take a filename to process.
Then, in the code for the beginning of your app, if you determine that
your app is to be shut down (because another instance is running), you
would hook up to the remoting server that the other app is hosting, and
make the call, passing the filename to process (it should be part of the
command line parameters).
If you are using .NET 2.0, all of this is done for you. There is an
question in the current issue of MSDN magazine in the ".NET Matters"
section. The question regards single-instance applications, and the
answer shows how all of this is done for you. You can find it at (watch
for line wrap):
http://msdn.microsoft.com/msdnmag/issues/05/09/NETMatters/default.aspx
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)
PJ Olson said:
I have an app that allows only one instance to run at a time. I have a
file extension associated with this app and would like to pass a running
instance the file name if a user double-clicks the file directly.
Any help would be greatly appreciated.
PJ