BBC BASIC for Windows
General >> General Board >> Detect program already running
http://bb4w.conforums.com/index.cgi?board=general&action=display&num=1262784339

Detect program already running
Post by mavison on Jan 6th, 2010, 12:25pm

Does anyone have BB4W code that would ...
1. Detect (on startup) if the program is already running
2. Bring original program window to front

I have searched, but not found!
Thanks

Re: Detect program already running
Post by admin on Jan 6th, 2010, 2:09pm

Quote:
Does anyone have BB4W code that would ...
1. Detect (on startup) if the program is already running
2. Bring original program window to front

1. is here:

http://bb4w.wikispaces.com/Detecting+a+second+instance+of+a+program

2. might be a little tricky, because Windows tries not to let one process fiddle with the window positioning of another process (because it's open to abuse). You might be able to do something by sending your original program a message for it to bring itself to the front.

Richard.
Re: Detect program already running
Post by mavison on Jan 6th, 2010, 2:47pm

Thanks Richard ... sorry, I had forgotten to search the Wiki!

The Mutex stuff works a treat. Still pondering if I can be bothered to find how to send a message and move window to top!