Colin,
Have a look at winapi for FindWindow. It might do what you want.
The only app I have that uses it has too much code around it for
me to post to here. I am quite happy to email you the whole code
in private.
We use it to stop multiple instances of apps for our simpler clients
by putting the app in each icon on teh desktop. It then executes
the desire app only if it doesnt find its window.
Two drawbacks...
1. If the target app changes its windowtitle - then thats what you
have to search for.
2. There is a window where the target app is just starting up and
cant be found and you can still launmch two copies.... this
happens only with people that do multiple clicks on teh icon - ie 2+
(for single click) or 4+ (for dblclick).
To: Multiple recipients of list delphi <[EMAIL PROTECTED]>
Send reply to: [EMAIL PROTECTED]
From: "Colin Fraser" <[EMAIL PROTECTED]>
Subject: [DUG]: Run Once Code
Date sent: Tue, 19 Jun 2001 16:38:26 +1200
> Hi,
>
> Does anyone have handy any code that will stop an application running more
> than once instance...
>
> I know there are some components around that you can just dump on the main
> form, but what I am after is to programmatically control how the app starts.
>
> For example, if there is a certain command line parameter then start a new
> instance, otherwise bring the new instance to the front and process the new
> command line parameters.
>
> Regards
>
> Colin
>
>
> ######################################################################
> Attention:
> The information in this email and in any attachments is confidential.
> If you are not the intended recipient then please do not distribute,
> copy or use this information. Please notify us immediately by return
> email and then delete the message from your computer.
> Any views or opinions presented are solely those of the author.
> ######################################################################
> ---------------------------------------------------------------------------
> New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
> Website: http://www.delphi.org.nz
> To UnSub, send email to: [EMAIL PROTECTED]
> with body of "unsubscribe delphi"
>
Regards
Rohit
======================================================================
CFL - Computer Fanatics Ltd. 21 Barry's Point Road, AKL, New Zealand
PH (649) 489-2280
FX (649) 489-2290
email [EMAIL PROTECTED] or [EMAIL PROTECTED]
======================================================================
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"