아래는 뮤텍스를 생성하고, 이미 생성되어 있는 경우 결과를 Boolean 형으로 리턴하는 함수이다.
Const
Chk_Mutex_Name = 'Check_Mutex_Created';
Function Is_VNC_Running : Boolean;
Var
Mutex : LongInt;
Begin
{ Mutex 생성}
Mutex := CreateMutex(nil, TRUE, Chk_Mutex_Name);
{ Mutex 생성 실패면 False }
If Mutex = 0 Then Begin
Result := True;
Exit;
End;
{ Mutex가 이미 생성되어 있음 }
If (GetLastError = ERROR_ALREADY_EXISTS) Then Begin
Result := True;
Exit;
End;
CloseHandle(Mutex);
Result := False;
End;



