Delphi中根据程序名称判断是否多开


本文整理自网络,侵删。

 
procedure TForm1.FormCreate(Sender: TObject);  
var  
errno:integer;  
hmutex:hwnd;  
begin  
hmutex:=createmutex(nil,false,pchar(application.Title));  
errno:=getlasterror;  
if errno=error_already_exists then  
begin  
ShowMessage(‘程序已经在运行了’);  
Application.Terminate;  
end;  
end;  

相关阅读 >>

winapi 字符及字符串函数(1): charlower - 字符或字符串转小写

Delphi 如何识别应用程序没有响应

Delphi中判断操作系统是否是windows7

Delphi base64加解密

Delphi char string

Delphi 直接将html字符串读入webbrowser中

Delphi的枚举类型

Delphi 中拖动无边框窗口的5种方法

Delphi 从网址链接中提取域名

Delphi 中 16 进制转换为 10 进制

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...