- Create a "Custom Class UserObject"
- Set the AutoInstantiate to TRUE
- Declare the Win32 API modul at the UserObject on Declare -> Local External Functions
Function Long GetLastError () Library 'kernel32.dll'
Function ULong CreateMutex (ULong lpsa, Boolean fInitialOwner, String lpszMutexName) Library 'kernel32.dll' Alias for CreateMutexA - Create a UserObject Function like this:
String ls_name
If Handle(GetApplication()) > 0 Then
ls_name = GetApplication().AppName + Char(0)
CreateMutex(0, True, ls_name)
If GetLastError() = 183 Then Return True
End If
Return False - Save the UserObject as uo_mutex (for example)
uo_mutex lou_mutex
If lou_mutex.uf_isrunning() Then
MessageBox ('Warning', 'Application is already running', StopSign!)
HALT CLOSE
End If
//...
// Your next line code
//...
0 comments:
Post a Comment