Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using addobject function
Message
De
09/05/2000 18:40:09
 
 
À
09/05/2000 17:59:28
Information générale
Forum:
Visual FoxPro
Catégorie:
Contrôles ActiveX en VFP
Divers
Thread ID:
00367882
Message ID:
00367892
Vues:
15
>I has an OCX and I wonder if I can use addobject to add teh OCX?
>
>lo = createobject('mycom.com')
>
>can perform the following?
>lo = create('form')
>lo.addobject(mycom.com)
>

AddObject requires two string parameters - the name to be associated with the newly-created object on the form, and the name of the class to instantiate.

lo.AddObject('MyCOMInstance','mycom.com')

would add an instance of mycom.com to the Form instance stored in lo which would then be referenced as lo.MyCOMInstance.method or property reference when needed.

Some ActiveX controls cannot be added directly to a form, and may require that you create an instance of the OLEControl class to serve as a wrapper on the object. Trying to do so gets the result 'Object class is invlaid for this container'. When this happens, you have two choices - create a subclass of the OLEControl class to wrap the ActiveX control, or use AddProperty to create a member property for the Form, and then create an instance of the ActiveX control via CREATEOBJ() and assign it to the member property.
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform