📄 runoncep.dpr
字号:
program RunOnceP;
uses
Forms,
Windows,
Dialogs,
RunOnceU in 'RunOnceU.pas' {Form1};
{$R *.res}
var
MutexHandle: Integer;
begin
{attempt to open a handle to the mutex. if this function is successful,
we know that the application has already started, and we can terminate}
if OpenMutex(MUTEX_ALL_ACCESS, FALSE, 'RunOnceMutex') <> 0 then
begin
ShowMessage('This application is already open!');
Exit;
end;
{if we get here, we are the first instance of this application, so
create the mutex and immediately acquire ownership of it}
MutexHandle := CreateMutex(nil, TRUE, 'RunOnceMutex');
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
{now that we are done, we must release the mutex}
ReleaseMutex(MutexHandle);
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -