Meeting the needs of your business from a distance

Ensuring a Single Instance of an Application

by Mark Shiffer 8/4/2008 8:46:00 AM
Most that have been playing this game for a while immediately think Mutex when you want to ensure your application only runs one instance at a time. I recently came across a .NET class that provides a different approach with some added functionality. The class is WindowsFormsApplicationBase. Unfortunately that class is in the Microsoft.VisualBasic.ApplicationServices namespace, so for C# you have to dirty your code with a VB namespace. The class is pretty simple. Just create it and set IsSingleInstance to true. You then have the ability to hook to events for OnStartupNextInstance, OnShutdown, OnCreateSplashScreen, etc... Worth checking out if you have this need.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , ,

Research | Programming

Related posts

Add comment


(Will show your Gravatar icon)  

  Country flag





Live preview

November 21. 2008 07:30

About the author

Name of author Mark Shiffer
CEO & CIO of MS Consulting

E-mail me Send mail

Calendar

<<  November 2008  >>
MoTuWeThFrSaSu
272829303112
3456789
10111213141516
17181920212223
24252627282930
1234567

View posts in large calendar

Pages

    Recent posts

    Recent comments

    Disclaimer

    The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

    © Copyright 2008

    Sign in

    Copyright © 2001-2008 MS Consulting, Inc. All Rights Reserved.