What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » InternetOpenUrlW - what am I doing wrong?

InternetOpenUrlW - what am I doing wrong?
Author: Message:
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
O.P. InternetOpenUrlW - what am I doing wrong?
code:
var INTERNET_FLAG_RELOAD = 2147483648;
var INTERNET_OPEN_TYPE_DIRECT = 1;
var INTERNET_OPEN_TYPE_PROXY = 3;

var Version = 1;

function OnEvent_Initialize(MessengerStart){
    CheckUpdate('http://mattyg.ca/test/', 'AutoUpdateTest');
}

function CheckUpdate(sUrl, sFile){
    var hOpen = Interop.Allocate(4);
    var hFile = Interop.Allocate(4);
    var sBuffer = Interop.Allocate(2*(1000)+2);
    var lBuffer = Interop.Allocate(4);
    lBuffer.WriteDWORD(0, 1000);
    var lRet;
   
    hOpen.WriteDWORD(0, Interop.Call('wininet', 'InternetOpenW', 'ScreenshotSender4Updater', INTERNET_OPEN_TYPE_DIRECT, '', '', 0));
    hFile.WriteDWORD(0, Interop.Call('wininet', 'InternetOpenUrlW', hOpen.ReadDWORD(0), sUrl+sFile+'.version', '', 0, INTERNET_FLAG_RELOAD, 0));
    Interop.Call('wininet', 'InternetReadFile', hFile.ReadDWORD(0), sBuffer.DataPtr, lBuffer.ReadDWORD(0), lRet);
   
    Interop.Call('wininet', 'InternetCloseHandle', hFile.ReadDWORD(0));
    Interop.Call('wininet', 'InternetCloseHandle', hOpen.ReadDWORD(0));
   
    Debug.Trace(sBuffer.ReadString(0));
}

Ya so what am I doing wrong? I tried passing lBuffer as a normal var (didn't work), tried passing 1000 didn't work. sBuffer.ReadString(0) is null so I am not sure what is wrong.
07-01-2006 03:07 AM
Profile E-Mail PM Find Quote Report
ShawnZ
Veteran Member
*****

Avatar

Posts: 3146
Reputation: 43
32 / Male / Flag
Joined: Jan 2003
RE: InternetOpenUrlW - what am I doing wrong?
off topic, but why not use xmlhttp?
Spoiler:
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
07-01-2006 05:29 AM
Profile PM Web Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
O.P. RE: InternetOpenUrlW - what am I doing wrong?
quote:
Originally posted by ShawnZ
off topic, but why not use xmlhttp?
It was working for me then all of a sudden without changing any code it stopped returning the value but instead a null string.
07-01-2006 05:31 AM
Profile E-Mail PM Find Quote Report
Eljay
Elite Member
*****

Avatar
:O

Posts: 2949
Reputation: 77
– / Male / –
Joined: May 2004
RE: InternetOpenUrlW - what am I doing wrong?
you use way too many datablocs where theyre not needed, and then dont use one where it is needed (lRet) :P

working code:

code:
var INTERNET_FLAG_RELOAD = 2147483648;
var INTERNET_OPEN_TYPE_DIRECT = 1;
var INTERNET_OPEN_TYPE_PROXY = 3;

var Version = 1;

function OnEvent_Initialize(MessengerStart){
    CheckUpdate('http://mattyg.ca/test/', 'AutoUpdateTest');
}

function CheckUpdate(sUrl, sFile){
    var sBuffer = Interop.Allocate((255+1) * 2);
    var lRet = Interop.Allocate(4);
   
    hOpen = Interop.Call('wininet', 'InternetOpenW', 'ScreenshotSender4Updater', INTERNET_OPEN_TYPE_DIRECT, 0, 0, 0);
    hFile = Interop.Call('wininet', 'InternetOpenUrlW', hOpen, sUrl+sFile+'.version', '', 0, INTERNET_FLAG_RELOAD, 0);
    test = Interop.Call('wininet', 'InternetReadFile', hFile, sBuffer, 255, lRet);
   
    Interop.Call('wininet', 'InternetCloseHandle', hFile);
    Interop.Call('wininet', 'InternetCloseHandle', hOpen);
   
    Debug.Trace(sBuffer.ReadString(0));
}
07-01-2006 07:27 AM
Profile PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
O.P. RE: InternetOpenUrlW - what am I doing wrong?
quote:
Originally posted by Eljay
you use way too many datablocs where theyre not needed, and then dont use one where it is needed (lRet) :P

<3 lj

Thanks ya I realized that I only needed the databloc for the hOpen and hFile if they are being passed as a param that recieves a return value.
07-01-2006 01:41 PM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On