Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Prevent Duplicate Instances of Modeless Form.
Message
De
20/11/1997 15:30:14
 
 
À
20/11/1997 15:26:58
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00061428
Message ID:
00061446
Vues:
57
>>>>>Is there an easy way to prevent two copies of a modeless form from running? I have been trying to use the FindWindowEx api call but I am getting frustrated with figuring out the class name of the child window I am looking for. Please help.
>>>>
>>>>Do you mean two modeless forms within the same application?
>>>
>>>My menu calls a form "MyForm" with "do form MyForm". I want to prohibit two running copies of "MyForm"
>>>
>>>How do you reply so fast?
>>
>>That's because question is easy.
>>****Formset.Startform method (you can also apply it to _screen)
>>parameter cFormname
>>if type("thisformset."+cFormname)="O"
>> this.&cFormname..show()
>> return 1
>>else
>> thisformset.addobject(cFormname,cFormname)
>> if type("thisformset."+cFormname)="O" && if Init successfully
>> this.&cFormname..show()
>> return 2
>> else
>> return 3
>> endif
>>endif
>
>Thanks for your answer. The formset part of it has me confused. My form is not a formset.

The idea is to check for form existence. If your form is not in formset, that you check in _SCREEN.Forms property-array.
For n=1 to _screen.formcount
if _screen.forms(n).name=cFormname
*** form is found
_screen.forms(n).show()
else
do form ... name ...
endif
Endfor
Edward Pikman
Independent Consultant
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform