⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 禁止运行同一程序的多个实例.txt

📁 是一部详细介绍了DELPHI的经典著作
💻 TXT
字号:
禁止运行同一程序的多个实例
有uses下面加入常量
CM_RESTORE=WM_USER+$1000;
在public段加入
procedure createparams(var params:Tcreateparams);override;
procedure restorerequest(var message:Tmessage);message CM_RESTORE;
在程序写入段中写入
procedure TForm1.createarams(var params:TCreateParams);
//初始化参数
begin
inherited createparams(params);
params.winclassname:=''我的Delphi程序;
end;
procedure TForm1.restorerequest(var message:TMessage);
//判断程序是否已经运行
begin
if isiconic(application.handle)=true then
 application.restore
else
 application.bringtofront;
end;
procedure Tform1.formcreate(sender:TObject);
//得到程序的句柄
begin
 label1.caption:=inttohex(application.hanele,8);
end;
end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -