Y
ysp_1984
Unregistered / Unconfirmed
GUEST, unregistred user!
program Project1;
uses
Forms, Windows,
Unit1 in 'Unit1.pas' {frmmain};
{$R *.res}
var
mutex:Hwnd;
begin
Application.Initialize;
Application.title:='text';
mutex:=CreateMutex(nil,false,'text');
if Getlasterror<>Error_Already_Exists then
begin
Application.CreateForm(Tfrmmain, frmmain);
Application.Run;
end
else
begin
Application.Messagebox('本程序同时只能运行一个','警告',mb_ok);
end;
ReleaseMutex(mutex);
end.
把 Application.title:='text';
mutex:=CreateMutex(nil,false,'text'); 这两句改为mutex:=CreateMutex(nil,false,Application.title); 就不对了,改成mutex:=CreateMutex(nil,false,pchar(Application.title))也不对。为什么阿?;
uses
Forms, Windows,
Unit1 in 'Unit1.pas' {frmmain};
{$R *.res}
var
mutex:Hwnd;
begin
Application.Initialize;
Application.title:='text';
mutex:=CreateMutex(nil,false,'text');
if Getlasterror<>Error_Already_Exists then
begin
Application.CreateForm(Tfrmmain, frmmain);
Application.Run;
end
else
begin
Application.Messagebox('本程序同时只能运行一个','警告',mb_ok);
end;
ReleaseMutex(mutex);
end.
把 Application.title:='text';
mutex:=CreateMutex(nil,false,'text'); 这两句改为mutex:=CreateMutex(nil,false,Application.title); 就不对了,改成mutex:=CreateMutex(nil,false,pchar(Application.title))也不对。为什么阿?;