nafa2221
asked on
Dupelicate Instantces
How do I check my program for duplicate instantaces??? Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
hi nafa2221,
a simple method
(modification in the dpr-file)
program itTimer;
uses
windows,
Forms,
Dialogs,
itGlobal in 'itGlobal.pas',
ufrmTIMER in 'ufrmTIMER.pas' {frmTIMER},
doitAPI in 'doitAPI.pas',
ufrmTIMERUpdate in 'ufrmTIMERUpdate.pas' {frmTimerUpdate},
ufrmTIMERShow in 'ufrmTIMERShow.pas' {frmTimerShow},
ufrmTimerSub in 'ufrmTimerSub.pas' {frmTimerSub},
ufrmErrorReport in 'ufrmErrorReport.pas' {frmErrorReport},
ufrmprobtimer in 'ufrmprobtimer.pas' {frmProblemeTimer};
{$R *.RES}
var StartUpH : THandle;
begin
StartUpH := FindWindow(PChar('TfrmTIME R'),PChar( 'inTIME · Timer'));
if (StartUpH <> 0) and (ParamStr(1) <> 'Test') then //no testenviroment
begin
// ShowWindow(StartUpH,SW_SHO W);
MessageDlg('itTimer ist bereits gestartet!',mtInformation, [mbOK],-1) ;
end
else
begin
Application.Initialize;
Application.Title := 'inTIME · Timer';
Application.CreateForm(Tfr mTIMER, frmTIMER);
Application.CreateForm(Tfr mTimerUpda te, frmTimerUpdate);
Application.Run;
end;
end.
meikl
a simple method
(modification in the dpr-file)
program itTimer;
uses
windows,
Forms,
Dialogs,
itGlobal in 'itGlobal.pas',
ufrmTIMER in 'ufrmTIMER.pas' {frmTIMER},
doitAPI in 'doitAPI.pas',
ufrmTIMERUpdate in 'ufrmTIMERUpdate.pas' {frmTimerUpdate},
ufrmTIMERShow in 'ufrmTIMERShow.pas' {frmTimerShow},
ufrmTimerSub in 'ufrmTimerSub.pas' {frmTimerSub},
ufrmErrorReport in 'ufrmErrorReport.pas' {frmErrorReport},
ufrmprobtimer in 'ufrmprobtimer.pas' {frmProblemeTimer};
{$R *.RES}
var StartUpH : THandle;
begin
StartUpH := FindWindow(PChar('TfrmTIME
if (StartUpH <> 0) and (ParamStr(1) <> 'Test') then //no testenviroment
begin
// ShowWindow(StartUpH,SW_SHO
MessageDlg('itTimer ist bereits gestartet!',mtInformation,
end
else
begin
Application.Initialize;
Application.Title := 'inTIME · Timer';
Application.CreateForm(Tfr
Application.CreateForm(Tfr
Application.Run;
end;
end.
meikl
Try this (put the code in .DPR file)
var Handle1: HWND;
begin
Application.Initialize;
Handle1 := FindWindow('TfrmMain','Cap tion');
if (Handle1 = 0) then begin
Application.CreateForm(Tfr mMain, frmMain);
...
Application.Run;
end
else
ShowMessage('App already running!');
end.
Obs: 'TfrmMain' = Class of Main Form
'Caption' = Caption on Main Form
cheers,
Fulvio.
var Handle1: HWND;
begin
Application.Initialize;
Handle1 := FindWindow('TfrmMain','Cap
if (Handle1 = 0) then begin
Application.CreateForm(Tfr
...
Application.Run;
end
else
ShowMessage('App already running!');
end.
Obs: 'TfrmMain' = Class of Main Form
'Caption' = Caption on Main Form
cheers,
Fulvio.
Fulvio, would you mind to withdraw your answer since other solutions have been given before you...?
No problem Epsylon!
What happend was when I posted it I didn't see the other solution (just 3 min. before)
See you,
F.
What happend was when I posted it I didn't see the other solution (just 3 min. before)
See you,
F.
Yup, I see :o)
Hi Epsylon, please, could you answer me why a lot of people offers the answer like a comment, what's the advantage?
And about the point? How they won the points?
I'm new in the site and never understood it :o)
Thanks in advance,
Fulvio.
And about the point? How they won the points?
I'm new in the site and never understood it :o)
Thanks in advance,
Fulvio.
Fulvio, when you're sure that the answer is correct AND your're the first one then you could submit it as answer. But when someone else has already given a (partial) solution, submit it as comment. This is an unwritten(?) rule here at EE...
Thanks Epsylon! :o)
ASKER