var
YunTansuoHandle, Mutex: THandle;
begin
Mutex := CreateMutex(nil, True, 'YunTansuoAppMain');
if Mutex <> 0 then
begin
if GetLastError = Windows.ERROR_ALREADY_EXISTS then //如果存在另一实例
begin
Closehandle(Mutex);
//找窗口,发消息,让其显示出来...
YunTansuoHandle := FindWindow('TYunTansuo_Main_Frm', nil);
if YunTansuoHandle <> 0 then
PostMessage(YunTansuoHandle, WM_RUNME_MESSAGE, $E218, 0);
ExitProcess(0);
Exit;
end;
end;
YunTansuoHandle, Mutex: THandle;
begin
Mutex := CreateMutex(nil, True, 'YunTansuoAppMain');
if Mutex <> 0 then
begin
if GetLastError = Windows.ERROR_ALREADY_EXISTS then //如果存在另一实例
begin
Closehandle(Mutex);
//找窗口,发消息,让其显示出来...
YunTansuoHandle := FindWindow('TYunTansuo_Main_Frm', nil);
if YunTansuoHandle <> 0 then
PostMessage(YunTansuoHandle, WM_RUNME_MESSAGE, $E218, 0);
ExitProcess(0);
Exit;
end;
end;
const
WM_RUNME_MESSAGE = WM_USER + 1000;
WM_RUNME_MESSAGE = WM_USER + 1000;
private
{ Private declarations }
{ Private declarations }
procedure OnRunMeMessage(var msg: TMessage); message WM_RUNME_MESSAGE;
procedure T'YunTansuoAppMain'.OnRunMeMessage(var msg: TMessage);
var
NewDemo: TForm;
begin //显示自己...
if msg.WParam = $E218 then
begin
//
end;
end;
var
NewDemo: TForm;
begin //显示自己...
if msg.WParam = $E218 then
begin
//
end;
end;