var
hMutex:HWND; //程序互斥对象句柄
Ret:Integer; //返回的错误句柄begin
Application.Initialize;
Application.Title := 'aaaaa';
hMutex := CreateMutex(nil,False,'aaaaa');
Ret:=GetLastError;
if Ret<>ERROR_ALREADY_EXISTS then
Begin
Application.CreateForm(TForm1, Form1);
Application.Run;
End
else
//Application.MessageBox('程序已经运行!','提示!',MB_OK);
EnableWindow(hMutex,true);
ReleaseMutex(hMutex);
end.
hMutex:HWND; //程序互斥对象句柄
Ret:Integer; //返回的错误句柄begin
Application.Initialize;
Application.Title := 'aaaaa';
hMutex := CreateMutex(nil,False,'aaaaa');
Ret:=GetLastError;
if Ret<>ERROR_ALREADY_EXISTS then
Begin
Application.CreateForm(TForm1, Form1);
Application.Run;
End
else
//Application.MessageBox('程序已经运行!','提示!',MB_OK);
EnableWindow(hMutex,true);
ReleaseMutex(hMutex);
end.
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货