|
-
Sep 18th, 2007, 12:33 PM
#1
Thread Starter
PowerPoster
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]
-
Sep 18th, 2007, 02:29 PM
#2
Frenzied Member
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
-
Sep 18th, 2007, 02:44 PM
#3
Thread Starter
PowerPoster
===================================================
If your question has been answered, mark the thread as [RESOLVED]
-
Sep 18th, 2007, 04:03 PM
#4
Frenzied Member
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
-
Sep 19th, 2007, 07:21 AM
#5
Thread Starter
PowerPoster
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|