program main;
uses
Forms,
windows,//
Unit1 in 'Unit1.pas' {Form1};
{$R *.res}
var hmutex:hwnd;
begin
Application.Initialize;
application.Title:='test';
hmutex:=createmutex(nil,false,'test');
if getlasterror<>error_already_exists then
begin
Application.CreateForm(TForm1, Form1);
Application.Run;
releasemutex(hmutex);
end else begin
application.MessageBox('本程序只允许同时运行一个','error');
end;
end.
防止程序运行多个
最新推荐文章于 2021-09-11 20:41:44 发布