Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Run a single copy of program

16 views
Skip to first unread message

Hsiu-Hsiang Li

unread,
Apr 22, 1996, 3:00:00 AM4/22/96
to
Hi!

Window only allows a single "delphi.exe" run at a time, while it allows
several notepad.exe's run at a time.

I want to set up my delphi application program, say "del_app.exe", run a
single copy at a time, i.e. when the 2nd time the "del_app.exe" icon clicked,
the window will bring up the minimized del_app.exe instead of creating a
brand new "del_app.exe".

Is there a property of Tapplication that I can set? Find a handle of
the application, in the project source file '?', restore the application if
it is found, otherwise create a new application?

Any help, hint would be appreciated. Thanks

Ernest Lim

unread,
Apr 23, 1996, 3:00:00 AM4/23/96
to Hsiu-Hsiang Li


Hi This is Ernest Lim from Singapore. I think there is no property in
delphi but I have use the Winprocs and some code to control running one
copy of my application.

Pls forgive me for the bad example as I just cut it out from one of my
project source.


Example :
************
uses
Forms,
Winprocs, {add in this code}
Aelev in 'AELEV.PAS' {AELEVEL},
Unitlev in 'UNITLEV.PAS' {Unitlevel},
Agntlev in 'AGNTLEV.PAS' {Agntlevel},
Agntdtl in 'AGNTDTL.PAS' {Agntprod},
Clntdtl in 'CLNTDTL.PAS' {Agntdetail},
Aboutbx in 'ABOUTBX.PAS' {AboutBox},
Gotoagnt in 'GOTOAGNT.PAS' {jump},
Sort1 in 'SORT1.PAS' {sorter};

{$R *.RES}
Begin
{Make sure that one copy of application is running only.}
If HPrevInst = 0 then
begin
Application.Title := 'Agency Tracking';
Application.CreateForm(TAELEVEL, AELEVEL);
Application.CreateForm(TUnitlevel, Unitlevel);
Application.CreateForm(TAgntlevel, Agntlevel);
Application.CreateForm(TAgntprod, Agntprod);
Application.CreateForm(TAgntdetail, Agntdetail);
Application.CreateForm(TAboutBox, AboutBox);
Application.CreateForm(Tjump, jump);
Application.CreateForm(Tsorter, sorter);
Application.Run;
end
else
If (SetFocus(FindWindow('TSorter', NIL)) = 0) then
else
If (SetFocus(FindWindow('TJump', NIL)) = 0) then
else
If (SetFocus(FindWindow('TAboutBox', NIL)) = 0) then
else
If (SetFocus(FindWindow('TAgntdetail', NIL)) = 0) then
else
If (SetFocus(FindWindow('TAgntprod', NIL)) = 0) then
else
If (SetFocus(FindWindow('TAgntlevel', NIL)) = 0) then
else
If (SetFocus(FindWindow('TUnitlevel', NIL)) = 0) then
else
If (SetFocus(FindWindow('TAELEVEL', NIL)) = 0) then
Messagebox(0, 'Error! Call Ernest (69)4331416', 'Application
Error', 0);
end.

Phoenix Business Enterprises

unread,
Apr 23, 1996, 3:00:00 AM4/23/96
to
>Window only allows a single "delphi.exe" run at a time, while it allows
>several notepad.exe's run at a time.

Windows does not do that, Delphi does.


_
******************************************************************
NOTE: This software is currently in early alpha. If you notice any
problems, or RFC non-compliance, please report it to p...@pobox.com
Please do not report duplicates, as this is usually a manual resend
+------------------------------------------------------------+
|Chad Z. Hower - pho...@pobox.com |
|Phoenix Business Enterprises - p...@pobox.com - www.pbe.com |
|Physically in Church Hill, TN - Logically Not Sure |
+------------------------------------------------------------+
>>SQUID - The ultimate 32 bit offline databasing reader
**Special Compile: 3.000A (Alpha)

Paul Bailey

unread,
Apr 24, 1996, 3:00:00 AM4/24/96
to prc...@shsu.edu
>I want to set up my delphi application program, say >"del_app.exe", run a
>single copy at a time, i.e. when the 2nd time the "del_app.exe" >icon clicked,
>the window will bring up the minimized del_app.exe instead of >creating a
>brand new "del_app.exe".

On the Delphi Super Page,

http://sunsite.icm.edu.pl/~robert/delphi/freelib.html

there is a freeware comp called "prevchek.zip"

PAUL

Paul Bailey

unread,
Apr 24, 1996, 3:00:00 AM4/24/96
to prc...@shsu.edu
0 new messages