Shoutbox

[Question] Any way I can get a Winsock ActiveXObject working ? - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: [Question] Any way I can get a Winsock ActiveXObject working ? (/showthread.php?tid=60242)

[Question] Any way I can get a Winsock ActiveXObject working ? by Pai on 06-06-2006 at 10:04 AM

If it's possible, which one ?

Thanks :P


RE: [Question] Any way I can get a Winsock ActiveXObject working ? by -dt- on 06-06-2006 at 10:19 AM

In my webserver script i was working on i used

code:
new ActiveXObject( "MSWinsock.Winsock.1" );


RE: [Question] Any way I can get a Winsock ActiveXObject working ? by Pai on 06-06-2006 at 05:46 PM

Doesn't seem to work here |:

code:
function Test()
{
var ws = new ActiveXObject( "MSWinsock.Winsock.1" );
return 'abc';
}
doesn't return anything


code:
function Test()
{
//var ws = new ActiveXObject( "MSWinsock.Winsock.1" );
return 'abc';
}
returns 'abc'

Any ideas ? |:
RE: [Question] Any way I can get a Winsock ActiveXObject working ? by matty on 06-06-2006 at 07:25 PM

quote:
Originally posted by Pai
Doesn't seem to work here |:

code:
function Test()
{
var ws = new ActiveXObject( "MSWinsock.Winsock.1" );
return 'abc';
}
doesn't return anything


code:
function Test()
{
//var ws = new ActiveXObject( "MSWinsock.Winsock.1" );
return 'abc';
}
returns 'abc'

Any ideas ? |:
Well when you use return "abc" your saying the return value of the function is "abc".

How about trying this :
code:

function Test(){
    var ws = new ActiveXObject( "MSWinsock.Winsock.1" );
    return ws.LocalIP;
}


RE: [Question] Any way I can get a Winsock ActiveXObject working ? by Pai on 06-06-2006 at 11:27 PM

Yes you are right, but my point was that "something wrong" happened when I declared the new ActiveXObject, stoping the function so that it didn't reach the line to return something.

I've tried that return ws.LocalIP in the past and also didn't work (and obviously I just retried it to make sure), making me believe that "MSWinsock.Winsock.1" isn't a valid ActiveXObject, at least in my pc :(


RE: [Question] Any way I can get a Winsock ActiveXObject working ? by CookieRevised on 06-07-2006 at 12:41 AM

Indeed not everyone has "MSWinsock.Winsock.1". Thus:

quote:
Originally posted by -dt-
In my webserver script i was working on i used
code:
new ActiveXObject( "MSWinsock.Winsock.1" );

Never use the "blahblah.1", "blahblah.2", "blahblah.3", etc objects. Not everybody has them.

The ".x" indicates that there are multiple versions registered on your computer (which may on its turn indicate duplicated, even corrupted objects).

When you omit the ".x", the default one is loaded instead (as that is its proper name; thus without that ".x"). And if present, the system will search for the latest (or not corrupted) version on its own.

Note1: This goes for all ActiveX objects, not just for "MSWinsock.Winsock".

Note2: When you use non standard ActiveX objects, or objects which depend on other possibly not installed stuff, always check if they exist on the hosts computer. Don't automatically assume that everybody has them.
RE: [Question] Any way I can get a Winsock ActiveXObject working ? by Patchou on 06-07-2006 at 03:39 AM

True, however, remember that Messenger Plus! Live cannot run on anything below Windows XP, this means that you can happily use any object that comes with XP without worrying about backward compatibility (just make sure you don't use objects installed by the SP2 or make sure your script displays appropriate errors to the user).


RE: [Question] Any way I can get a Winsock ActiveXObject working ? by L. Coyote on 06-07-2006 at 04:51 AM

Well, Winsock without the .1 doesn't work with me either. [Image: xso_undecided.gif]


RE: [Question] Any way I can get a Winsock ActiveXObject working ? by Pai on 06-07-2006 at 06:43 AM

I appreciate everyone's explanation, but before I started this topic I googled a bit (ok a lot) and found a couple of Winsock ActiveXObjects ("OSWINSCK.Winsock" and "MSWinsock.Winsock") which I have tried and didn't work, so "MSWinsock.Winsock" didn't work for me either :(

After debugging my script, I found an interesting thing:

» when I use ActiveXObject "MSWinsock.Winsock" or "MSWinsock.Winsock.1", I get in the debugger

code:
Error: unknown.
       Line: 128. Code: -2147221230.

» when I use ActiveXObject "MSWinsock.Winsock.x", I get error
code:
Error: The Automation server can't create the object.
       Line: 128. Code: -2146827859.

So, I *should* be able to use that but my PC can't create it ?

PS: The debugger text was translated back to english as close as I can get, because it was in Portuguese, so it might not be as accurate as the proper english text.

edit:

PS2: How can I find out for sure what ActiveXObjects I have installed in my system ? Or a way to find out which Objects I have, because I'm starting to think that something went wrong when I installed XP and the winsock object didn't got installed :X
RE: [Question] Any way I can get a Winsock ActiveXObject working ? by -dt- on 06-07-2006 at 06:52 AM

quote:
Originally posted by Pai
PS2: How can I find out for sure what ActiveXObjects I have installed in my system ? Or a way to find out which Objects I have, because I'm starting to think that something went wrong when I installed XP and the winsock object didn't got installed :X
I use ActiveX manager
RE: RE: [Question] Any way I can get a Winsock ActiveXObject working ? by segosa on 06-07-2006 at 06:57 AM

quote:
Originally posted by Matty
quote:
Originally posted by Pai
Doesn't seem to work here |:

code:
function Test()
{
var ws = new ActiveXObject( "MSWinsock.Winsock.1" );
return 'abc';
}
doesn't return anything


code:
function Test()
{
//var ws = new ActiveXObject( "MSWinsock.Winsock.1" );
return 'abc';
}
returns 'abc'

Any ideas ? |:
Well when you use return "abc" your saying the return value of the function is "abc".

How about trying this :
code:

function Test(){
    var ws = new ActiveXObject( "MSWinsock.Winsock.1" );
    return ws.LocalIP;
}



What? No, when you use return 'abc' you return the string 'abc'. return abc; would attempt to return the function pointer. 8-)
RE: RE: [Question] Any way I can get a Winsock ActiveXObject working ? by Pai on 06-07-2006 at 11:39 AM

quote:
Originally posted by -dt-
quote:
Originally posted by Pai
PS2: How can I find out for sure what ActiveXObjects I have installed in my system ? Or a way to find out which Objects I have, because I'm starting to think that something went wrong when I installed XP and the winsock object didn't got installed :X
I use ActiveX manager


I downloaded and installed ActiveX Manager 1.4 (thanks -dt-) and I have Microsoft Winsock Control 6.0 (SP6), tho in the version column appears as 1.0, installed and registered and it's ProgID is "MSWinsock.Winsock.1" ... So according to Cookie's explanation my correct ActiveXObject would be "MSWinsock.Winsock", or even "MSWinsock.Winsock.1" (just for the sake of making the damn script work :x)...

But guess what ... it doesn't work |:

Does anyone have a little idea of what's going on and what I'm missing ? :(

Thanks!
RE: [Question] Any way I can get a Winsock ActiveXObject working ? by Patchou on 06-07-2006 at 08:50 PM

I'm sorry I can't help you much with this object as I'm not used to it, however, what I can do is give you the translation of the first error you got:

-2147221230 : Class is not licensed for use
That means that the object was registered as needing some kind of license key to run.


RE: [Question] Any way I can get a Winsock ActiveXObject working ? by Pai on 06-07-2006 at 08:54 PM

Why the hell does my Winsock ActiveX need a license and noone else needs it ? :S

And is there any way to "reinstall" winsock ?

Also, this might be a problem for scripts that use this ActiveX, as there might be other people that have the same problem as I :(


RE: [Question] Any way I can get a Winsock ActiveXObject working ? by CookieRevised on 06-08-2006 at 12:05 PM

Certain ActiveX objects (even general ones) come only with certain programs you install in Windows. But not all of these ActiveX objects can be used by 3rd party developpers.

It is only when you install a legit development packet, for example, Visual Studio, Visual Basic, etc, that many ActiveX objects will recieve a design-time license so they can be used by 3rd party developpers (aka: you).

Now, if for any reason these ActiveX objects were installed after you have installed a development packet, the ActiveX objects will not recieve their design-time license update. If they were already installed on the system prior to installing the development packet, then they will recieve their design-time license.

You can try to fix this by reading the following KB's:
http://support.microsoft.com/kb/181854/EN-US/
http://support.microsoft.com/kb/194751/EN-US/
http://support.microsoft.com/kb/177799/EN-US/


RE: [Question] Any way I can get a Winsock ActiveXObject working ? by Pai on 06-08-2006 at 02:58 PM

Thank you Cookie, I actually use Borland Delphi so I figure the license would already be installed ... Also, I can import Winsock through the ActiveX import wizard, but when I try to use it it says "License information for TWinsock not found." so that confirms your ideia.

Also after googling a bit I found this site that contains a fix for this, but I need VB installed for it to work, which I don't have nor intend to ...

Well, the bigger issue in this for me isn't that I won't be able to use winsock in my scripts, but other scripts that use it and when they are released to the general public people like me will have problems with them (considering that the percentage of developers that have the necessary licenses to use the script will be small)...


RE: RE: [Question] Any way I can get a Winsock ActiveXObject working ? by CookieRevised on 06-08-2006 at 04:21 PM

quote:
Originally posted by Patchou
True, however, remember that Messenger Plus! Live cannot run on anything below Windows XP, this means that you can happily use any object that comes with XP without worrying about backward compatibility (just make sure you don't use objects installed by the SP2 or make sure your script displays appropriate errors to the user).
This doesn't automatically mean you can use any ActiveX object you have or which comes with XP though... In fact, only a very few ActiveX objects come nativly with XP which everybody can use without any restrictions. All other ActiveX objects are installed with SDK's like Visual Studio and the likes.

quote:
Originally posted by Pai
Also after googling a bit I found this site that contains a fix for this, but I need VB installed for it to work, which I don't have nor intend to ...
the stuff talked about in that thread is exactly a part of what is said in the KB articles I linked to.

quote:
Originally posted by Pai
Well, the bigger issue in this for me isn't that I won't be able to use winsock in my scripts, but other scripts that use it and when they are released to the general public people like me will have problems with them (considering that the percentage of developers that have the necessary licenses to use the script will be small)...
yep, this is exactly why I said that developpers should be very carefully in using ActiveX objects in my first posts (even those who seem to be 'general' and wide spread) and not automatically assuming that if they have them installed, everybody has them installed.

There is nothing you can do about this unless you obtain a license for them (thru installing a legit licensed development package).
RE: [Question] Any way I can get a Winsock ActiveXObject working ? by Patchou on 06-08-2006 at 05:22 PM

If you want to use Winsock you can always use Interop calls or create a quick ActiveX yourself to be used by the script. That shouldn't be too much of a problem :).


RE: [Question] Any way I can get a Winsock ActiveXObject working ? by Pai on 06-08-2006 at 07:22 PM

Right, but that is way too much trouble if you can just find a way to get the Winsock ActiveX to work..

After googling for the afternoon, I found the solution ! This page offers the download of a file that fixes the winsock issue.

So, I managed to fix my problem, but this whole ActiveX stuff not working in every PC is really "bad for business" for script developers |:

Moderator edit: links removed


RE: [Question] Any way I can get a Winsock ActiveXObject working ? by CookieRevised on 06-08-2006 at 07:33 PM

May I strongly note that the file offered by that page is illegal!
It is not allowed to distribute license keys...
If it was allowed I simply could have told you the license key myself in the first place (and many other keys for that matter). It isn't a fix at all.


RE: [Question] Any way I can get a Winsock ActiveXObject working ? by Pai on 06-08-2006 at 07:45 PM

Well I didn't know that, nor the page says anything about it ...

If an admin or Patchou wishes I can remove the links!