PrevInstance 
Author Message
 PrevInstance

I am trying to determine if my PocketPC 2002 Application is already running,
(From Form_Load).

In Visual Basic 6.0 etc, you can use App.PrevInstance but eVB App object
doesn't have PrevInstance.

Thanks in Advance.

Rick



Fri, 27 Aug 2004 09:28:19 GMT  
 PrevInstance
' ----------------- Code for "Check Previous Instance of this program"
logic ----------------------
Const ERROR_ALREADY_EXISTS = 183

Public Declare Function CreateMutex Lib "Coredll" Alias "CreateMutexW" _
   (lpMutexAttributes As Long, _
   ByVal bInitialOwner As Long, _
   ByVal lpName As String) As Long

Public Declare Function GetLastError Lib "Coredll" () As Long

Private Function AlreadyExists() As Boolean

    Dim error_code

    CreateMutex CLng(0), 1, App.Title

    If GetLastError() = ERROR_ALREADY_EXISTS Then
        AlreadyExists = True
    Else 'run the application
        AlreadyExists = False
    End If

End Function

HTH

Tony



Quote:
> I am trying to determine if my PocketPC 2002 Application is already
running,
> (From Form_Load).

> In Visual Basic 6.0 etc, you can use App.PrevInstance but eVB App object
> doesn't have PrevInstance.

> Thanks in Advance.

> Rick



Fri, 27 Aug 2004 17:01:22 GMT  
 PrevInstance
Also documented in Q258088.

http://support.microsoft.com/support/kb/articles/q258/0/88.asp

-mike

This posting is provided AS IS with no warranties, and confers no rights.



Sun, 29 Aug 2004 05:51:58 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. VB.NET and PrevInstance

2. App.PrevInstance

3. PrevInstance Doesn't work !!!

4. PrevInstance Query

5. App.PrevInstance

6. Help. App.Previnstance, DDE and such

7. A Better PrevInstance Example: Can't get it to work

8. Use of App.PrevInstance

9. App.PrevInstance

10. App.PrevInstance help req (newbie)

11. PrevInstance Lockup

12. App.PrevInstance pseudo-bug?

 

 
Powered by phpBB® Forum Software