Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How do you insure you run only one instance of a form?
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00256254
Message ID:
00262011
Views:
20
Dear Jeff,

You can use the windows API to see if a window with the same name that your application has is already open, and exit your main program if it is:

* Program-ID..: MAIN.PRG
* Purpose.....: Entry point for my accounting system

...

DECLARE INTEGER ShowWindow IN win32api INTEGER,INTEGER
LOCAL AlreadyRunning
AlreadyRunning = Is_Run32('Pinter Accounting')
IF AlreadyRunning > 0
=ShowWindow(AlreadyRunning,2)
=ShowWindow(AlreadyRunning,1)
RETURN
ENDIF

Good Luck,

Les Pinter
Publisher, Les Pinter's Database Journal
Les Pinter
(650) 344-3969
Les@LesPinter.com for consulting bookings.
www.LesPinter.com.

Watch for my forthcoming book on "Developing Database Applications in VFP and VB.NET".
Previous
Reply
Map
View

Click here to load this message in the networking platform