Prev: Registry permissions...
Next: Problem with copyhere
From: Shawn Fessenden on 19 Nov 2005 19:49 > 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_'. In this context (scripting), it's the prefix of subs that are to handle events. > This should work on a developing machine with VS-6 installed. Yes, according to all documentation, it's supposed to work. In fact, it doesn't work for *any* events, nevermind Winsock. There are plenty of examples of how to connect scripted objects to callbacks, but none of them that I've tried work. Even using the newer ConnectObject call doesn't work. Either it really just doesn't work like MS says, or there's something that none of the examples are saying. I'd love to hear from someone who has this working, but thank you for your comments all the same. At least I know I'm not going crazy! -SHAWN-
From: Saran on 19 Nov 2005 21:15 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? (I didn't remember seeing it explicitly, but may it's part of something?)
From: mayayana on 20 Nov 2005 15:40
It works fine for me using my own ActiveX EXE components. As long as it's WScript.CreateObject, the the second parameter can be used with any valid events. When finished, you should use DisconnectObject before quitting. It is awkward using many objects that way in script, though, because the script has to have a way to keep looping while waiting for events. Something like the winsock OCX is designed to be running on a VB form, where there's continuity. -- mayayanaXX1a(a)mindXXspring.com (Remove Xs for return email.) Shawn Fessenden <shawn#no#@testech-ldt.#spam#com> wrote in message news:yKPff.1128$Y%5.157(a)newssvr17.news.prodigy.com... > > 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_'. > > In this context (scripting), it's the prefix of subs that are to handle > events. > > > This should work on a developing machine with VS-6 installed. > > Yes, according to all documentation, it's supposed to work. In fact, it > doesn't work for *any* events, nevermind Winsock. There are plenty of > examples of how to connect scripted objects to callbacks, but none of them > that I've tried work. Even using the newer ConnectObject call doesn't work. > > Either it really just doesn't work like MS says, or there's something that > none of the examples are saying. I'd love to hear from someone who has this > working, but thank you for your comments all the same. At least I know I'm > not going crazy! > -SHAWN- > > |