Habe eine Verständnisfrage zum Beitrag viewtopic.php?f=16&p=260173#p260173
Hier hat PureLust einen Beitrag von mk-soft folgendermaßen zusammengefasst:
Code: Alles auswählen
Global g_hMutexAppRunning
Procedure AppInstanceExists()
Protected bAppRunning = FALSE;
g_hMutexAppRunning = CreateMutex_( #Null, #Null, "Global\MyApplication1");
If (g_hMutexAppRunning <> #Null) And (GetLastError_() = #ERROR_ALREADY_EXISTS)
CloseHandle_( g_hMutexAppRunning );
g_hMutexAppRunning = #Null;
EndIf
If g_hMutexAppRunning
ProcedureReturn #False;
Else
ProcedureReturn #True
EndIf
EndProcedure
If AppInstanceExists()
MessageRequester("Info", "Programm läuft bereit - zweite Instanz wird beendet.")
End
Else
MessageRequester("Info", "Programm läuft noch nicht - dies ist die erste Instanz.")
EndIf
; !!! NICHT VERGESSEN !!! - Global Mutex wieder freigeben
CloseHandle_(g_hMutexAppRunning)
edit:
Und: Wird das "Global g_hMutexAppRunning" überhaupt in dieser Zusammenfassung benötigt?