Results 1 to 5 of 5

Thread: Enforce single copy

  1. #1

    Thread Starter
    PowerPoster Pasvorto's Avatar
    Join Date
    Oct 2002
    Location
    Minnesota, USA
    Posts
    2,951

    Enforce single copy

    I know how to check the 'single copy only' box for VB2005 apps. However, I can't find that box (under the application tab) for a mobile device. How do I enforce only one copy?
    ===================================================
    If your question has been answered, mark the thread as [RESOLVED]

  2. #2
    Frenzied Member
    Join Date
    Oct 2005
    Posts
    1,286

    Re: Enforce single copy

    Hi,
    if it is a PocketPC, then I am pretty sure that the operating system enforces this on your behalf.

    Try starting your app, then starting it again - it should switch to your original app.

    If it is windowsce, you need to look at 'createmutex'


    Pete
    Pete Vickers
    MVP - Device Application Development
    http://www.gui-innovations.com http://mobileworld.appamundi.com/blogs/

  3. #3

    Thread Starter
    PowerPoster Pasvorto's Avatar
    Join Date
    Oct 2002
    Location
    Minnesota, USA
    Posts
    2,951

    Re: Enforce single copy

    It is WindowsCE
    ===================================================
    If your question has been answered, mark the thread as [RESOLVED]

  4. #4
    Frenzied Member
    Join Date
    Oct 2005
    Posts
    1,286

    Re: Enforce single copy

    Hi,
    Code:
    Public Declare Function CreateMutex Lib "Coredll.dll" (ByRef lpMutexAttributes As Integer, _
                                ByVal bInitiaOwner As Integer, ByVal lpName As String) As Integer
      Public Declare Function GetLastError Lib "CoreDll.dll" () As Integer
    
        Const ERROR_ALREADY_EXISTS = 183
    
    
    Call CreateMutex(CInt(0), 1, "<Application Name")
    
    If GetLastError() = ERROR_ALREADY_EXISTS Then
                MessageBox.Show("<Application Name> is already running.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1)
                Application.Exit()
            Else
    Should give you a start
    Pete Vickers
    MVP - Device Application Development
    http://www.gui-innovations.com http://mobileworld.appamundi.com/blogs/

  5. #5

    Thread Starter
    PowerPoster Pasvorto's Avatar
    Join Date
    Oct 2002
    Location
    Minnesota, USA
    Posts
    2,951

    Re: Enforce single copy

    I will give it a try. Thanks. This all started when I was in "development mode". I would deploy the app to the scanner. It has 2 forms. Form 1 opens form2. When form2 closes form1 shoudl open. Anyway, when I tried to close the app, I found another copy running, and another! Not sure how, but I want to enforce them not being able to do it.
    ===================================================
    If your question has been answered, mark the thread as [RESOLVED]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width