你需要打开你的工程文件源码,输入如下代码即可
这个是通过互斥来实现只允许一个程序实例运行:
文字代码如下:
var
MutexHandle: THandle;
begin
MutexHandle := Windows.CreateMutex(nil, true, 'JingxiCalssVideo');
if MutexHandle <> 0 then
if GetLastError = Windows.ERROR_ALREADY_EXISTS then
begin
Application.MessageBox('重复登录!', '系统提示', MB_ICONERROR);
CloseHandle(MutexHandle);
Halt;
end;
Application.Initialize;
Application.CreateForm(TDataDm, DataDm);
if not Live3tApp.Initialize then
Exit;
Application.Title := Appstr.TitleCaption;
Application.ShowMainForm := True;
Application.CreateForm(Tdm, dm);
Application.CreateForm(TFrmMain, FrmMain);
Application.Run;
end.
|