You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello. I suggest add functionality to the TUniqueInstance procedure.Loaded when the first instance is detected.
When the first instance of the program is detected, call the handler of this event: FOnFirstIntstanceRunned(self, TerminateSelf);
For this we add fields: FOnFirstIntstanceRunned : TOnFirstIntstanceRunned;
and a type procedure TOnFirstIntstanceRunned (Sender : TObject; var TerminateSelfApplication) of object;
Then the code will look like
...
//A instance is already running
//Send a message and then exit
TerminateSelf:=true;//Default choice
if Assigned(FOnOtherInstance) then
begin
IPCClient.Active := True;
if Assigned(FOnFirstIntstanceRunned ) then
FOnFirstIntstanceRunned(self, TerminateSelf);
if Assigned(FOnPrepareParam) then
SendPreparedParams(IPCClient)
else
IPCClient.SendStringMessage(ParamCount, GetFormattedParams);
end;
if TerminateSelf then begin
Application.ShowMainForm := False;
Application.Terminate;
end;
end
...
The text was updated successfully, but these errors were encountered:
Hello. I suggest add functionality to the TUniqueInstance procedure.Loaded when the first instance is detected.
When the first instance of the program is detected, call the handler of this event:
FOnFirstIntstanceRunned(self, TerminateSelf);
For this we add fields:
FOnFirstIntstanceRunned : TOnFirstIntstanceRunned;
property OnFirstIntstanceRunned: TOnFirstIntstanceRunned read FOnFirstIntstanceRunned write FOnFirstIntstanceRunned;
and a type
procedure TOnFirstIntstanceRunned (Sender : TObject; var TerminateSelfApplication) of object;
Then the code will look like
The text was updated successfully, but these errors were encountered: