var hMutex: HWND; begin //hMutex := CreateMutex(nil,True,'_MingTest'); hMutex := CreateEvent(nil,False,False,'_MingTest'); if GetLastError = ERROR_ALREADY_EXISTS then begin MessageBox(0,'This program has executed!','Error!',0); Exit; end; Application.Initialize; Application.CreateForm(TForm1, Form1); Application.Run; end.