Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How do I know if a form is in use already?
Message
De
11/01/2001 21:33:23
 
 
À
11/01/2001 21:31:58
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00462522
Message ID:
00462740
Vues:
13
>>With a modeless form that is used with other forms, is there a way to see if that form is already open so to avoid being opened again. Other than at application level where I would set a app property
>
>You can also look at using My ClsEvent class to implement a single-instance anything - it can be used to do a single-instance app, form, etc. To do a single-instance form:
>
>
*  In Form's Init:
>SET PROCEDURE TO CLSEVENT ADDITIVE
>PRIVATE oAppEvent
>oAppEvent = CREATEOBJ('cusEvent','MyFormWhatEver')
>IF TYPE('oAppEvent') # 'O'
>   *  My form is already running
>   RETURN .F.
>ELSE
>   this.AddObject('oFormInstanceEvent',oAppEvent)

this should read:

    this.AddProperty('oFormInstanceEvent',oAppEvent)

>   oAppEvent = NULL
>ENDIF
>
>*  In Form's Destroy:
>this.oFormInstanceEvent = NULL
>
>Note - this will only allow 1 instance of the Form in all instances of your app on a given machine. You can assign an app-level instance variable and save it in your application object, and concatenate that with the form event name to limit it to one instance of the form per instance of the app running. It's a handy way to limit concurrent access to any resource on a given system. It's all VFP source, one procedure file, and a sample single-instance app prefix demo.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform