- 人气:
- 放大
- 缩小
- 二维码
- 赞赏
delphi 进程程序多开调用单元
unit fun;
interface
uses
Windows,Forms,SysUtils,TlHelp32,ActiveX,ComObj,ShlObj;
procedure Mutex;//进程互斥
implementation
uses 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.