Dim win as Winsock??
How come the following code does not work?
Dim win as Winsock
set win = new Winsock
[96 byte] By [
jimmy6] at [2007-11-11 9:53:28]

# 1 Re: Dim win as Winsock??
winsock is an ActiveX usercontrol, and it cannot be created with the New statement. You have either to add the control at design time to a container (i.e. a Form) like a normal control (like a TextBox), or add it at run time using the Controls.Add method
mstraf at 2007-11-11 17:23:40 >

# 2 Re: Dim win as Winsock??
what is Controls.Add?
jimmy6 at 2007-11-11 17:24:40 >

# 3 Re: Dim win as Winsock??
this msdn page shows how to use Controls.Add
http://support.microsoft.com/kb/190670
mstraf at 2007-11-11 17:25:38 >

# 4 Re: Dim win as Winsock??
Man; Of corse since it's an activeX so It's made for new instance(s) or tell me how u have many sockect connections at same time ::U can navigate in many webpages at the same time !!
the code :
Dim win as Winsock
set win = new Winsock
must work well !! just check if u added the winsock control in your project references .
Amahdy at 2007-11-11 17:26:43 >

# 5 Re: Dim win as Winsock??
There is no winsock in the references, it only exist in components there. Any idea?
jimmy6 at 2007-11-11 17:27:42 >

# 6 Re: Dim win as Winsock??
Of corse if u search for ".dll" only u will not find any ".ocx"
Here what u must do :
- remove the winsock from components and any use of it in your forms
- open project reference
- in searched file name change fille type to "OCX"
- now search for "MSWINSOCK.OCX" control in your <system path> {ex: c:\windows\system32\ -default at most }
Amahdy at 2007-11-11 17:28:43 >

# 7 Re: Dim win as Winsock??
??
winsock.dll is a standard library and not an activeX library, therefore you cannot make a reference to it. It is still possible to use it from VB, but only as API calls (try google for "winsock.dll vb6" and you'll find example of .bas files with the Declare of the library funcions)
But it is much easier to use the winsock control (that is a ActiveX wrapper to the library) Anyway, because it is a control cannot be instanciate with the New operator
mstraf at 2007-11-11 17:29:36 >

# 8 Re: Dim win as Winsock??
??
winsock.dll is a standard library and not an activeX library, therefore you cannot make a reference to it.
OK look again ; I'm taking about "MSWINSOCK.OCX" the activeX component that exist in your system directory and u can use it in your components and can make reference to it ...
Look man ; winsock.dll is standard for windows but the one exist in visual basic components is MSWINSOCK.OCX ;; it must be "OCX" not "DLL" as it's a component ; hence when u reference to it u can use the code listed in the original post just look in those two pics :
http://i15.tinypic.com/3yeu981.jpg
U can search for it from "Browse" button; and u can verify that it's the same used in [components]
http://i9.tinypic.com/4hlynax.jpg
Try it :)
Amahdy at 2007-11-11 17:30:39 >

# 9 Re: Dim win as Winsock??
??
But it is much easier to use the winsock control (that is a ActiveX wrapper to the library) Anyway, because it is a control cannot be instanciate with the New operator
The only problem is the winsock control u are talking about "MSWINSOCK.OCX" doesn't exist in standard windows so u need to bind it with your application before let other use it.
I mean the benefit of using winsock.dll APIs is to make your application availaible to use without need to register any activx .
time.
Amahdy at 2007-11-11 17:31:44 >

# 10 Re: Dim win as Winsock??
...Try it
yep, it works. Thanks
mstraf at 2007-11-11 17:32:44 >
