Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
MSWinsock
Message
De
30/11/1999 11:11:30
 
 
À
30/11/1999 10:58:08
Information générale
Forum:
Visual FoxPro
Catégorie:
Contrôles ActiveX en VFP
Titre:
Divers
Thread ID:
00296895
Message ID:
00296905
Vues:
36
>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.

>Osock = createobject("PrgSocket")
>Osock.LocalPort = 5001
>Osock.Protocol = 1
>
>Define Class PrgSocket as OleControl
> Oleclass = "MSWinsock.Winsock"
> function DataArrival
> lparameter bytestotal
> wait window allt(str(bytestotal)) nowait
> return
> endfunc
>enddefine
>
>This however does work but I don't know how to add code to the dataarrival event.
>
>Osock = createobject("MSWinsock.Winsock")
>Osock.Protocol = 1
>Osock.LocalPort = 5001
>
>Any ideas would be greatly appreciated.
>Thanks for the help!
>David
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