Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
OLE Exception code using my class
Message
From
22/08/2007 15:15:13
 
 
To
22/08/2007 13:25:55
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Environment versions
Visual FoxPro:
VFP 8 SP1
Miscellaneous
Thread ID:
01249645
Message ID:
01249687
Views:
18
When connecting to a COM object you have to specify more than the class name. By default, it's the project name, so something like
ox = CREATEOBJECT("MyProject.Emps_Class")
>Getting this error:
>
>OLE IDispatch exception code 0 from Winsock: Wrong protocol or connection state for the requested transaction or request.
>
>On the 2nd line:
>
>
>ox = CREATEOBJECT( "EMPS_Class" )
>ox.oSock.SendData("This is a test.")
>
>
>And this is the class definition:
>
>
>**********************************************************
>DEFINE CLASS EMPS_Class AS SESSION OLEPUBLIC
>**********************************************************
>
>	IMPLEMENTS DMSWinsockControlEvents IN "c:\windows\system32\mswinsck.ocx"
>
>	**********************************************************
>	PROCEDURE DMSWinsockControlEvents_Error(NUMBER AS INTEGER, DESCRIPTION AS STRING, Scode AS NUMBER, SOURCE AS STRING, HelpFile AS STRING, HELPCONTEXT AS NUMBER, CancelDisplay AS LOGICAL) AS VOID HELPSTRING "Error occurred"
>		* add user code here
>
>		ENDPROC
>
>
>	**********************************************************
>	PROCEDURE DMSWinsockControlEvents_DataArrival(bytesTotal AS NUMBER) AS VOID HELPSTRING "Occurs when data has been received from the remote computer"
>
>		strData = SPACE(256)  && Define string to pass to GetData
>
>		THIS.oSock.OBJECT.GETDATA(@strData)
>
>		* Testing code to parse HL7 billing data from Medinotes Client to EM tables
>		=Convert_HL7_Billing_Data(strData)
>
>		ENDPROC
>
>
>	**********************************************************
>	PROCEDURE DMSWinsockControlEvents_Connect() AS VOID HELPSTRING "Occurs connect operation is completed"
>		* add user code here
>
>		ENDPROC
>
>
>	**********************************************************
>	PROCEDURE DMSWinsockControlEvents_ConnectionRequest(requestID AS NUMBER) AS VOID HELPSTRING "Occurs when a remote client is attempting to connect"
>
>		#DEFINE sckClosed 0
>
>		IF THIS.OBJECT.State <> sckClosed
>			THIS.oSock.OBJECT.CLOSE
>		ENDIF
>
>		*!* Accept the request with the requestID
>		*!* parameter.
>		THIS.oSock.OBJECT.ACCEPT(requestID)
>
>		ENDPROC
>
>
>	**********************************************************
>	PROCEDURE DMSWinsockControlEvents_Close() AS VOID HELPSTRING "Occurs when the connection has been closed"
>		* add user code here
>
>		ENDPROC
>
>
>	**********************************************************
>	PROCEDURE DMSWinsockControlEvents_SendProgress(bytesSent AS NUMBER, bytesRemaining AS NUMBER) AS VOID HELPSTRING "Occurs during process of sending data"
>		* add user code here
>
>		ENDPROC
>
>
>	**********************************************************
>	PROCEDURE DMSWinsockControlEvents_SendComplete() AS VOID HELPSTRING "Occurs after a send operation has completed"
>		* add user code here
>
>		ENDPROC
>
>
>	oSock = NULL
>
>
>	**********************************************************
>	PROCEDURE INIT
>
>		THIS.oSock = CREATEOBJECT("MSWinsock.Winsock.1")
>		EVENTHANDLER(THIS.oSock, THIS)
>
>		ENDPROC
>
>ENDDEFINE
>
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform