Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
EventHandler() problems
Message
De
26/08/2005 13:45:21
 
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP
Divers
Thread ID:
01044248
Message ID:
01044386
Vues:
12
Hello,

just guessing, but from the code you've provided i see the problem that the objects go out of scope after the function returns, you may try to save them into object properties instead.
DEFINE CLASS classname AS session OLEPUBLIC

oEvents = .NULL.
oTcp = .NULL.

FUNCTION tcpconnect

THIS.oEvents = CreateObject("MSWinsockEvents")
THIS.oTcp=CreateObject("MSWinsock.Winsock.1")

THIS.oEvents.oMSWinsockObject = oTcp
THIS.oEvents.oMainObject = This
THIS.oEvents.cSporocilo = cTXT

EventHandler(THIS.oTcp, THIS.oEvents) && .t.

THIS.oTcp.Protocol= 0  && sckTCPProtocol
THIS.oTcp.Connect(This.cIP, This.cPort)
…
…

RETURN .T.
ENDDEFINE
Regards
Christian
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform