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?
Printable View
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?
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
It is WindowsCE
Hi,
Should give you a startCode: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
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.