Question single-instance, secondary instance

Michael Allison

New member
Joined
Aug 8, 2008
Messages
2
Programming Experience
Beginner
I'm trying to make a program that is single-instance. Every time a secondary instance of it comes up, I want it to tell the first instance that this happened somehow. I don't know anything about Remoting, or Windows API, and I really need help here, like, just a sample code I could put in or something.

Everyone in our programming group is on vacation, and I'm left with the work of about four people, and I'm inferior to most of them.. If anyone could just show me the way to do this, in a simple, easy to understand manner, I'd be extremely thankful. I've spent over four days doing this one, simple thing.

The reason I want it to tell the first instance that an attempt to open a second one has occured is because my program uses an "Open With..." kind of thing. In other words, they can double-click a file to open it. But if it's single instance, it's not going to try to open it in the same instance automatically. So I need it to check, each time a secondary instance is neutralized, that they weren't trying to open another file; and if they were, I'll use a function to open said file. I can handle all that, but I can't handle the part where I use Inter-Process Communication...

Can someone help, please? Thanks :(...
 
Go to Project properties, Application tab, check "make single instance". Click "view application events" and handle the StartupNextInstance event.
This information come from the first help topic that displays about "single instance".
 
I guess this really was a dumb question. I wish Google had been a bit more help :eek:. Since they didn't display any results when I searched multiple phrasings of my problem, I just resorted to asking a question, didn't think about searching here. I shall next time!

Thanks very much, this topic can be closed if you'd like. I knew you could create a single instance application in .NET with that method, but I didn't know you could make a sub that handled a new instance being created that easily. Neither did anyone in various IRC channels, either, ha-ha.
 
Back
Top