Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. sponsors. rss.
 From: Yousfi Benameur
  Where is Yousfi Benameur?
 El Bayadh
 Algeria
 Yousfi Benameur
 To: Stefan Wuebbe
  Where is Stefan Wuebbe?
 Hamburg
 Germany
 Stefan Wuebbe
 Tags
Subject: RE: Eventhandler on Winsock OCX
Thread ID: 218822 Message ID: 219537 # Views: 24 # Ratings: 0
Version: Visual FoxPro 9 SP2 Category: Web, FTP and other Internet Protocols
Date: Thursday, March 05, 2009 9:43:49 PM         
   


> > The event definition was made by the object browser.
> > But I think it wasn't 100% correctly.
> > I found the solution after a little bit trying. Now it works.
> > I commented the lines which were changed.
> >
>
> Interesting, thanks for sharing your results.
>
>
> -Stefan
>
>
> >
> > The event definition was made by the object browser.
> > But I think it wasn't 100% correctly.
> > I found the solution after a little bit trying. Now it works.
> > I commented the lines which were changed.
> >
> >
RELEASE ALL
> > myWinsockServerEvents=NEWOBJECT("WinsockServerEvents")
> > myWinsockServer=NEWOBJECT("MSWinsock.Winsock.1")		&&here I changed MSWinsock.Winsock to MSWinsock.Winsock.1
> > EVENTHANDLER(myWinsockServer,myWinsockServerEvents,.T.)
> > myWinsockServer.LocalPort="1112"
> > myWinsockServer.Listen()
> > **
> > myWinsockClient=NEWOBJECT("MSWinsock.Winsock.1")		&&here I changed MSWinsock.Winsock to MSWinsock.Winsock.1
> > myWinsockClient.Connect("192.168.20.108","1112")
> > myWinsockClient.Close
> > 
> > DEFINE CLASS WinsockServerEvents AS session OLEPUBLIC
> > 
> >  	IMPLEMENTS DMSWinsockControlEvents IN MSWinsock.Winsock.1 &&here I changed "c:\windows\system32\mswinsck.ocx" to MSWinsock.Winsock.1
> >  
> >  	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"
> >  	* add user code here
> >  	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"
> >  				MESSAGEBOX(requestID)
> >  	* add user code here
> >  	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
> > ENDDEFINE



Hi Stefan
VFP seems dont make any difference between oleclass "MSWInsock.winsock.1" and "MSWinsock.Winsock" ?
If upload the winsock.ocx on a form the oleclass is :"MSWInsock.winsock.1"
But with a prg can build the form with the ocx for the two names without any returned error !

Its the same thing with for ex the browser IE
yform=createObject("asup")
yform.show(1)
*
DEFINE CLASS asup AS form
	DoCreate = .T.
	width=400
	height=300
	Name = "Form1"

	ADD OBJECT olecontrol1 AS olecontrol WITH ;
	oleclass="Shell.Explorer.2",; 
		Top = 12, ;
		Left = 24, ;
		Height = 300, ;
		Width = 400, ;
		Name = "Olecontrol1"
procedure init
thisform.olecontrol1.navigate("www.google.com/")

ENDDEFINE


it runs for oleclass="Shell.Explorer.2" but also for oleclass="Shell.Explorer"

FOXHelp:cName
The named class ID of the object. This is the registered name of the application that was used to create the object or will be invoked if the object is activated.

but this Name is it unique ?

Dont rate please.its only for the pleasure to help.Give me only a feed back.
Yousfi Benameur



COMPLETE THREAD
Eventhandler on Winsock OCX Posted by Stefan Pochert @ 3/2/2009 10:26:04 AM
RE: Eventhandler on Winsock OCX Posted by Yousfi Benameur @ 3/4/2009 10:37:41 PM
RE: Eventhandler on Winsock OCX Posted by Stefan Pochert @ 3/5/2009 9:20:04 AM
RE: Eventhandler on Winsock OCX Posted by Stefan Wuebbe @ 3/5/2009 9:23:49 AM
RE: Eventhandler on Winsock OCX Posted by Yousfi Benameur @ 3/5/2009 9:43:49 PM
RE: Eventhandler on Winsock OCX Posted by Stefan Wuebbe @ 3/6/2009 7:54:01 AM