project1.dpr

来自「Delphi7应用编程150例附书源码.rar」· DPR 代码 · 共 26 行

DPR
26
字号
program Project1;

uses
  Forms,
  Windows,
  Unit1 in 'Unit1.pas' {Form1};

{$R *.res}
var
    hMutex:hWnd;
begin
  Application.Initialize;
  Application.Title:='test';
  hMutex:=CreateMutex(nil,false,'test');
  if GetLastError<>Error_Already_Exists then
  begin
    Application.CreateForm(TForm1, Form1);
    Application.Run;
  end
  else
  begin
    Application.MessageBox('本程序只允许同时运行一个','Error');
    ReleaseMutex(hMutex);
  end;
end.

⌨️ 快捷键说明

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