Keeping a form single instanced on pocket pc

Posted on 2004-11-11
Last Modified: 2010-04-23
I need to prevent multiple copies of the same form from being opened by a user.  This is easy to do with the full .NET framework (using the System.Diagnostics.Process object to get a list of running processes and looking for the apps name twice) but the mobile framework System.Diagnostics does not include the Process object.  

Anyone know of an easy way to get a list of processes on pocket pc or have an alternate solution?  Thanks for any help.
Question by:mbwatkins
    LVL 14

    Expert Comment

    Are you currently having this problem or are you expecting to have it? If an app is running on a PocketPC and you re-execute the application, the PockePC simply re-activates the app if it doesn't have focus.

    Author Comment

    I'm curretnly having this problem.  If I select the form from the programs list, a second instance of the form definitely starts as a second process.
    LVL 18

    Accepted Solution

    If you can not get the process, either using the Dotnet way or WIn32 way,
    like explained in these articles

    then there is no proper way..

    What at the most you can do is
    When ever your application starts, write it somewhere that an instance has started, on a file/registry may be..
    I dont know if you can write in a shared memory area in Dotnet or not. If yes then that would be ideal and when ever the new application starts it should check from there, that if an instance is present or not.
    and while closing the application it should be cleared
    LVL 2

    Expert Comment

    create a form instance in module as a public
    public objname as new frmname()
    then when you want to open a form just write

    this aproch will create form instance just a single time

    Author Comment

    The main problem was caused by debug mode.  You can open a second instance of the installed app behind a running debug instance.  The semaphore solution would've worked as well.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    I'm currently working for a company where I have to upgrade over 50 VB6 programs to VB.NET 2008.  So far I'm about half way through, and I've learned quite a few tricks that drastically improve the performance of VB.NET apps. Because there are a…
    A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    794 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

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now