I'm using Inno Setup for the first time and just a beginner in Pascal.

My code:

XMLHTTP := CreateOleObject('MSXML2.ServerXMLHTTP');
XMLHTTP.Open('GET', myUrl, False);
MyFileStream := TFileStream.Create(Path + MyFilename, fmCreate or fmOpenWrite);

But,I don't know how to use MyFileStream to write XMLHTTP.ResponseBody or XMLHTTP.ResponseStream.

Could you please help me?


You can use MyFileStream.Write(); Please look in the help for parameter info. I think the first can be a string, and the second the length. If you want to write ResponseStream, there might be some other options.

Yes, I saw the Write() method. But I don't know how to pass the parameters in. I tried:

MyFileStream.Write((XMLHTTP.ResponseBody, ...);

but for the size, how to I get it? I tried

XMLHTTP.ResponseBody.Size, but it doesn't work.


Thanks. The compiler doesn't complain any more when I use Length(...).

However, the file I want to download is an exe file at:

It's a 15MB file.


MyFileStream.Write(XMLHTTP.ResponseBody, Length(XMLHTTP.ResponseBody));

the file written down by TFileStream only has around 7MB. And when I run the downloaded exe file, it says "Programs too big to fix in memory".

Then if I do:

MyFileStream.Write(XMLHTTP.ResponseStream, Length(XMLHTTP.ResponseStream));

Then I would receive a runtime error:

Exception: Invalid variant type conversion.

Any advice on how to download this adobe air file using Pascal?


This article has been dead for over six months. Start a new discussion instead.