本文整理自网络,侵删。
unit fun;
interface
uses Windows,Forms,SysUtils,TlHelp32,ActiveX,ComObj,ShlObj;
procedure Mutex;//进程互斥implementationuses main;
procedure Mutex;var hMutex:HWND;begin///////////////////////////////创建互斥进程///////////////////////////// hMutex := CreateMutex(nil,True,'johntao'); if hMutex <> 0 then if GetLastError = ERROR_ALREADY_EXISTS then begin Application.MessageBox('禁止多开登陆器!','提示信息',MB_OK); Application.Terminate; end;///////////////////////////////end/////////////////////////////////////end;end.
用法:
begin Mutex;//进程互斥 Application.Initialize; Application.CreateForm(Tfrm_main, frm_main); Application.Run;end.
相关阅读 >>
Delphi controlcount和componentcount的区别
Delphi getprocessmemoryinfo获取进程占用内存大小
Delphi richedit 的scrollbar自动向下滚动
Delphi 工程判断内存溢出reportmemoryleaksonshutdown := true;
Delphi tms web core twebhttprequest使用
更多相关阅读请进入《Delphi》频道 >>