Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 153
  • Last Modified:

Dupelicate Instantces

How do I check my program for duplicate instantaces??? Thanks!
0
nafa2221
Asked:
nafa2221
1 Solution
 
EpsylonCommented:
On this page you can see how to do that:

http://www.gnomehome.demon.nl/uddf/pages/api.htm#api0
0
 
nafa2221Author Commented:
that was somewhat confusing, can u post an example and where I would post the code, also can u tell me howto get to the area I am supposed to post my code? Thanks!!!
0
 
kretzschmarCommented:
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('TfrmTIMER'),PChar('inTIME · Timer'));
  if (StartUpH <> 0) and (ParamStr(1) <> 'Test') then  //no testenviroment
  begin
//    ShowWindow(StartUpH,SW_SHOW);
    MessageDlg('itTimer ist bereits gestartet!',mtInformation,[mbOK],-1);
  end
  else
  begin
    Application.Initialize;
    Application.Title := 'inTIME · Timer';
    Application.CreateForm(TfrmTIMER, frmTIMER);
  Application.CreateForm(TfrmTimerUpdate, frmTimerUpdate);
  Application.Run;
  end;
end.

meikl
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
fulvio_brasilCommented:
Try this (put the code in .DPR file)

var Handle1: HWND;

begin
  Application.Initialize;
  Handle1 := FindWindow('TfrmMain','Caption');
  if (Handle1 = 0) then begin
    Application.CreateForm(TfrmMain, frmMain);
    ...
    Application.Run;
  end
  else
    ShowMessage('App already running!');
end.

Obs: 'TfrmMain' = Class of Main Form
     'Caption' = Caption on Main Form

cheers,

Fulvio.
0
 
EpsylonCommented:
Fulvio, would you mind to withdraw your answer since other solutions have been given before you...?
0
 
fulvio_brasilCommented:
No problem Epsylon!

What happend was when I posted it I didn't see the other solution (just 3 min. before)

See you,

F.
0
 
EpsylonCommented:
Yup, I see   :o)
0
 
fulvio_brasilCommented:
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.
0
 
EpsylonCommented:
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...
0
 
fulvio_brasilCommented:
Thanks Epsylon! :o)
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now