Re: winsock??
- From: "mayayana" <mayayanaXX1a@xxxxxxxxxxxxxxxx>
- Date: Sun, 20 Nov 2005 20:31:47 GMT
As Christoph said, maybe it's not properly registered.
You might want to re-regisrer the file, since WSH doesn't
seem to be finding the ProgID in the Registry.
I have VB6 installed and this works fine for me:
Set Test = WScript.CreateObject("MSWinsock.Winsock", "_TEST")
MsgBox test.LocalIP
Set test = Nothing
But the Winsock OCX is not really designed for
script. Some of its methods involve non-variant
data types. So I don't know whether it's possible
to actually use it to achieve something. On the
other hand, if you hasve VB6 and VB.Net then
why would you be trying to use winsock from
script?
--
mayayanaXX1a@xxxxxxxxxxxxxxxx
(Remove Xs for return email.)
Saran <none@nospam> wrote in message
news:O2QhjYf7FHA.1020@xxxxxxxxxxxxxxxxxxxxxxx
> Christoph Basedau wrote:
> > 20.11.2005 01:46, Saran schrieb:
> >
> >> Christoph Basedau wrote:
> >>> 19.11.2005 18:31, Saran schrieb:
> >
> >>>> test.vbs
> >>>> ----------
> >>>> SET Test = CreateObject("MSWinsock.Winsock", "TEST_")
> >>>>
> >>>> SUB Test_Connect()
> >>>> msgBox "Test::Connected"
> >>>> END SUB
> >>>> ----------
> >>>> error: The remote server machine does not exist or is unavailable:
> >>>> 'CreateObject'
> >>>
> >>> The second param is optional and defines the remote machine where
> >>> the component is installed. The error is reproducible, if there is
> >>> no machine named 'TEST_'.
> >>
> >> Thank you. Every example I found uses the 2nd param for defining the
> >> event handler prefix, so now I'm confused.
> >
> > It's confusing indeed.
> > There is CreateObject(VBScript) and WScript.CreateObject(WSH).
> > Both expect two strings (2nd is optional).
> > VBScript's CreateObject wants a remote-machine as 2nd param, WSH's
> > WScript.CreateObject rather treats the 2nd string as a prefix for
> > routines catching events.
> >
> > for details see:
> >
http://msdn.microsoft.com/library/en-us/script56/html/vsfctCreateObject.asp?
frame=true
> >
http://msdn.microsoft.com/library/en-us/script56/html/wsMthCreateObject.asp?
frame=true
> >
> >
> >>>> If I use WScript.CreateObject instead of just CreateObject by
> >>>> itself, I
> >>>> get this error instead:
> >>>> ----------
> >>>> C:\test\test.vbs(1, 1) WScript.CreateObject: Could not create
> >>>> object named "MSWinsock.Winsock".
> >>>> ----------
> >>>
> >>> This should work on a developing machine with VS-6 installed.
> >>> Check if the ocx is present and try to re-register the component:
> >>>
> >>> regsvr32 %WINDIR%\System32\MSWINSCK.OCX
> >>
> >> Ran that, it still gives me the error.
> >>
> >> Heres one of the exmaples I came across:
> >
> >
> >> '----------- example.vbs -----------
> >> Dim Raw
> >> set Raw = WScript.CreateObject("MSWinsock.Winsock", "WSEvent_")
> >> Raw.Connect "10.25.1.157" , 9100
> >> msgbox "Running - close to continue"
> >> Raw.Close
> >
> > No idea. If you can't create it, then it's probably an installing
> > problem. I also have VS 6 and VS 2003 and your code works here.
> > One thing noteworthy is that Winsock-ocx is licensed, i am not sure if
> > licensing problems display the standard 429 - ActiveX - can't create
> > etc error. Also on developing machine licensed controls should be
> > creatable by script.
> > If it was on a non-development-machine, the error would make sense.
>
> I have VS 6.0 Ent (which includes VB 6.0 along with VC++ and such), and
> VS .NET 2003 Pro (VB.NET, VC++.NET, C#, J#)
>
> *What* exactly is *required* to use winsock in wbscript? Is there a
> particular item when installing (on either VS 6 or VS.NET 2003) ?? (I
> didn't remember seeing it
> explicitly, but may it's part of something?)
>
> Thanks.
>
>
.
- Follow-Ups:
- Re: winsock??
- From: Saran
- Re: winsock??
- From: Saran
- Re: winsock??
- References:
- Re: winsock??
- From: Saran
- Re: winsock??
- Prev by Date: XP firewall - open ports 135 and 445 limited to a specific IP address?
- Next by Date: Re: winsock?
- Previous by thread: Re: winsock??
- Next by thread: Re: winsock??
- Index(es):
Relevant Pages
|