' mutex sample ' ' Windows10 x64 22H2 + FreeBASIC 1.10.1 32bit #include once "windows.bi" Const mutex_name = "MyProgramName" Dim As HANDLE hMsp hMsp = CreateMutex(NULL, TRUE, strptr(mutex_name)) If hMsp <> 0 Then Dim As DWORD ret = GetLastError() If ret = ERROR_ALREADY_EXISTS Or ret = ERROR_ACCESS_DENIED Then ' Already Print "Already running. Exit." ReleaseMutex(hMsp) CloseHandle(hMsp) end End If End If Print "Running ... " Print "Push Any Key" sleep ReleaseMutex(hMsp) CloseHandle(hMsp)