Terminate Previous Instance.

  • 19 years ago

    I want to prevent multiple instances of my application from being created.  I have found examples of how to check the App.PrevInstance property to see if another instance is running.  My problem is, all of these examples terminate the new instance, and activate the prior instance.  I want to do it the other way, I want to terminate the old one, and let the new one start normally.  Can anyone give me some direction on how to do this?

    Thanks in advance.

  • 19 years ago

    Why would you want to do that?? What happens about unsaved data etc...? Anyway, if you have the hWnd of the other window, you could send a message to it (using SendMessage), which your app then subclasses ... and quits if it receives it.

Post a reply

Enter your message below

Sign in or Join us (it's free).


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“There are 10 types of people in the world, those who can read binary, and those who can't.”