pfreelsn.dpr

来自「一个自动注册监控程序」· DPR 代码 · 共 40 行

DPR
40
字号
program pfreelsn;

uses
  Forms,
  Windows, Messages, SysUtils,
  freelsn in 'freelsn.pas' {Form1};

{$R *.res}
var
     MutexHandle: THandle;
     hPrevInst: Boolean;

begin
 	MutexHandle := createMutex(nil, TRUE, 'MysampleAppMutex');
 	if MutexHandle <> 0 then
  	begin
          if GetLastError = ERROR_ALREADY_EXISTS then
          begin
               MessageBox(0, '解决时间限制软件正在运行,请稍后再次运行!',
                             '程序已经运行!', mb_IconHand);

	       hPrevInst := TRUE;
  	       CloseHandle(MutexHandle);
               Halt;
               application.Terminate;
          end
   	     else
              begin
                   hPrevInst := FALSE;
              end;
   	end
     else
         begin
 	         hPrevInst := FALSE;
         end;
  Application.Initialize;
  Application.CreateForm(TForm1, Form1);
  Application.Run;
end.

⌨️ 快捷键说明

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