Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
MSWinsock
Message
De
30/11/1999 12:10:40
 
 
À
30/11/1999 12:03:18
Information générale
Forum:
Visual FoxPro
Catégorie:
Contrôles ActiveX en VFP
Titre:
Divers
Thread ID:
00296895
Message ID:
00296935
Vues:
33
>>>I have been using a MSWinsock control on a form in an application and now wish to using it in a program and want to put code in the dataarrival event. I have tried the following but it does not work I get an error that says 'Object class is invalid for this container.'
>>>
>>
>>That message usually indicates that you tried to add an OleCOntrol somewhere that didn't like it (like to _screen).
>>
>>In order to respond to events, you're going to have to create a custom class that will provide VFP code to hook into the Winsock control's events, and bind the custom class to the Winsock ActiveX control (NOT the OleControl that sits on the form!) using VFPCOM, an add-on that, among other things, can examine the available events for an ActiveX control and produce a template .PRG that can be used as a starting point for writing the custom class, and bind the events of an ActiveX control to correspondingly-named methods of an instance of the custom class.
>
>Thanks for the response Ed. I have changed my mind and decided to subclass a form and add the Winsock control to the form in the class designer. I did this and used creatobject to create and instance of the new form class. However the DataArrival event does not seem to fire. Have I done something wrong or does your above explanation apply in this case also?
>

You still need to use VFPCOM to expose the event so that VFP will do something when the event fires. VFP does not link in events that it is internally unaware of; VFPCOM provides a mechanism to tie an event from a COM object to VFP through exposed memthods of a custom class.

IOW, you've got to use VFPCOM to do what you need done. You need a way for VFP to detect the event and tie the event to something inside of the VFP application.
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