I've seen a number of ways for doing this, everything from using DDE to the Global ATOM table to Window Titles to Existence of a File (file semaphore) to Hidden Windows. While some of them are quite ingenious, they all appeared to have some inherent drawbacks that I wanted to avoid, so I'd like to share a few others that I put together sometime back using a GUID and...: #1 an Application Property, #2 a Mutex, or #3 a Semaphore. My personal preference is #3.
Using A Unique Window Property
Using A Mutex
Using A Semaphore
-- Craig SBoyd
-- The above doesn't work properly if the whole thing uses top-level forms, i.e. the VFP window is hidden at all times. If you try to run a second instance the first one is brought forward OK, but with a VFP window behind it. -- Alan Bourke
(That's a side-effect of using BringWindowToTop - Set Foreground Window behaves better.)
No comments:
Post a Comment