 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Iwan Budihalim Guest
|
Posted: Fri Oct 31, 2003 3:18 am Post subject: Prevent window not to run more than one |
|
|
How to prevenet window / application not to run more than one ?
Thanks
Iwan
|
|
| Back to top |
|
 |
Ian Kirk Guest
|
Posted: Fri Oct 31, 2003 9:14 am Post subject: Re: Prevent window not to run more than one |
|
|
"Iwan Budihalim" <Iwan_budihalim (AT) visuallabs (DOT) net> wrote
| Quote: |
How to prevenet window / application not to run more than one ?
|
Try a Google Groups search for "Delphi application more than once".
Remember to stand to one side as you press the enter key, to prevent
yourself being washed away by the flood of posts where this question's been
asked before.
HTH
Ian
|
|
| Back to top |
|
 |
Chris Morgan Guest
|
Posted: Fri Oct 31, 2003 9:55 am Post subject: Re: Prevent window not to run more than one |
|
|
| Quote: | Remember to stand to one side as you press the enter key, to prevent
yourself being washed away by the flood of posts where this
question's been
asked before.
|
LOL
To borrow someone else's quote
"Google is your friend"
Cheers,
Chris
|
|
| Back to top |
|
 |
Mono Guest
|
Posted: Fri Oct 31, 2003 2:40 pm Post subject: Re: Prevent window not to run more than one |
|
|
Hi, here's an article for you:
Controlling the number of application instances
http://delphi.about.com/library/weekly/aa100703a.htm
In this article you'll learn how to "run-once enable" a Delphi application
that can check for its previous (running) instance. Along the process,
several techniques of implementing such a check will be discussed; as well
as how to bring your already running application to the foreground, if a
user tries to run it "one more time". By the end of the article you'll have
a copy-to-go code to control the behavior of your application's multiple
instances: with the option to limit the number of running instances.
...............................................
Zarko Gajic, BSCS
About Guide to Delphi Programming
http://delphi.about.com
how to advertise: http://delphi.about.com/library/bladvertise.htm
free newsletter: http://delphi.about.com/library/blnewsletter.htm
forum: http://forums.about.com/ab-delphi/start/
...............................................
"Iwan Budihalim" <Iwan_budihalim (AT) visuallabs (DOT) net> wrote
| Quote: |
How to prevenet window / application not to run more than one ?
Thanks
Iwan
|
|
|
| Back to top |
|
 |
Brian Cook Guest
|
Posted: Fri Oct 31, 2003 5:30 pm Post subject: Re: Prevent window not to run more than one |
|
|
| Quote: | Hi, here's an article for you:
|
The author failed to protect the shared memory with a Mutex.
- Brian
|
|
| Back to top |
|
 |
Marcio Ehrlich Guest
|
Posted: Sat Nov 01, 2003 2:29 pm Post subject: Re: Prevent window not to run more than one |
|
|
"Iwan Budihalim" <Iwan_budihalim (AT) visuallabs (DOT) net> wrote:
| Quote: | How to prevenet window / application not to run more than one ?
|
Search Google for "Mutex". And see this example for an application named
"MyApplication.dpr".
program MyApplication;
uses
Forms,
Windows,
MainUnit in 'MainUnit.pas' {MainForm};
{$R *.RES}
begin
if OpenMutex(MUTEX_ALL_ACCESS, False, 'MyApplication') = 0 then
begin
CreateMutex(nil, False, 'MyApplication');
Application.Initialize;
Application.CreateForm(TMainForm, MainForm);
Application.Run;
end
else
begin
SetForegroundWindow(FindWindow('TMainForm','MainForm'));
end;
end.
Good Luck,
Marcio
|
|
| Back to top |
|
 |
Brian Cook Guest
|
Posted: Sat Nov 01, 2003 6:24 pm Post subject: Re: Prevent window not to run more than one |
|
|
| Quote: | How to prevenet window / application not to run more than one ?
Search Google for "Mutex". And see this example for an application named
"MyApplication.dpr".
program MyApplication;
uses
Forms,
Windows,
MainUnit in 'MainUnit.pas' {MainForm};
{$R *.RES}
begin
if OpenMutex(MUTEX_ALL_ACCESS, False, 'MyApplication') = 0 then
begin
CreateMutex(nil, False, 'MyApplication');
|
This code is not 100% reliable. It is possible for two (or more)
instances of the application to start.
- Brian
|
|
| Back to top |
|
 |
Ed Guest
|
Posted: Tue Nov 04, 2003 3:25 pm Post subject: Re: Prevent window not to run more than one |
|
|
At sourceforge.net there's a TurboPower product called OnGuard. It has a
small unit you can add to an application. The unit allows you to do exactly
what you're wanting to do.
"Brian Cook" <bcook@rowdydogsoftware[REMOVE].com> wrote
| Quote: | How to prevenet window / application not to run more than one ?
Search Google for "Mutex". And see this example for an application named
"MyApplication.dpr".
program MyApplication;
uses
Forms,
Windows,
MainUnit in 'MainUnit.pas' {MainForm};
{$R *.RES}
begin
if OpenMutex(MUTEX_ALL_ACCESS, False, 'MyApplication') = 0 then
begin
CreateMutex(nil, False, 'MyApplication');
This code is not 100% reliable. It is possible for two (or more)
instances of the application to start.
- Brian
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|