Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


In Windows Mobile Application, how to create only one instance of application?

Posted on 2007-10-14
Medium Priority
Last Modified: 2013-12-27

I have an application I wrote in C# to be run on a windows mobile device.
The application works fine but here's a problem.

When ever I double click my application.exe, it starts a new application even if there is an existing one running. I want it so that if application.exe is already running, and user clicks to start a new application.exe, this brings up the existing application.exe without starting a new one.

Take Pocket Internet Explorer for example. When you already have IE running, and click to run IE again, this does not start a new IE application. It simply brings up the existing IE.

How can I do something like this for my application?

Thank you.

Question by:blast010
1 Comment
LVL 14

Accepted Solution

Jai S earned 100 total points
ID: 20075806
you can use this to check

using System.Diagnostics;

write this code in your form load
            Process[] CurrentProcesses;
            CurrentProcesses = Process.GetProcessesByName(Process.GetCurrentProcess().ProcessName);
//instead of return you can end you application...
//this code will check whether there is another process running with the same name
            if(CurrentProcesses.GetUpperBound(0) > 0) return;


Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Let me explain this picture a little bit.  First, in case you haven't already guessed, you are looking at my 2 phones, an Android Samsung Galaxy S5 on the left and an iPhone 5 on the right.  They are on their respective cradles on my desk.  But, you…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question