Hello,
I'm using Inno Setup for the first time and just a beginner in Pascal.
My code:
But,I don't know how to use MyFileStream to write XMLHTTP.ResponseBody or XMLHTTP.ResponseStream.Code:XMLHTTP := CreateOleObject('MSXML2.ServerXMLHTTP'); XMLHTTP.Open('GET', myUrl, False); XMLHTTP.Send(); ... MyFileStream := TFileStream.Create(Path + MyFilename, fmCreate or fmOpenWrite);
Could you please help me?
Thanks,
Maggie
Last edited by Jaan; 09-18-2009 at 05:06 AM. Reason: Please use code tags when you are posting your codes !
Is this Object Pascal, Delphi, something else?
You haven't really offered much information. Is your goal to read from the FileStream and push the results to the XMLHTTP? Also, if XMLHTTP is getting data from a URL, the responsebody would be from the data the URL sent. Also, responsebody is read-only, so you cannot copy the contents of filestream into the responsebody.
I want to write the content of XMLHTTP.ResponseStream (or ResponseBody -- don't know what to use) into a file. There is a Write() method for TFileStream:
function Write(Buffer: String; Count: Longint): Longint;
but I don't know how to get the String and the Count from.
Thanks,
Maggie
I think Count is optional. It would probably be something like Write(XMLHTTP.REsponseBody)
No, it will give a compiler error: "Invalid number of parameters"
Based on this: Delphi: Reading and writing a file to and from a string
Write(XMLHTTP.REsponseBody,Length(XMLHTTP.REsponse Body))
Thanks. The compiler doesn't complain any more when I use Length(...).
However, the file I want to download is an exe file. It's a 15MB file.
But
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".Code:MyFileStream.Write(XMLHTTP.ResponseBody, Length(XMLHTTP.ResponseBody));
Then if I do:
Then I would receive a runtime error:Code:MyFileStream.Write(XMLHTTP.ResponseStream, Length(XMLHTTP.ResponseStream));
Exception: Invalid variant type conversion.
Any advice on how to download this adobe air file using Pascal?
Thanks,
Maggie
Last edited by Jaan; 09-19-2009 at 09:55 AM. Reason: Please use code tags when you are posting your codes !
What exactly are you trying to do? It sounds like you shouldn't be using the XMLHTTP object at all.
Try looking at this: Programmatically Download Web Documents from the Internet using Delphi
I have to agree - that XML object is for parsing XML structures, not downloading EXEs from websites.
Either download that EXE yourself and include it with the INNO installer, or try something like this free utility: HTTPCOPY (you'll have to Google it)
Which you could include temporarily within your installer, i.e. install it to the TEMP folder, then run it, like this:
Having said that, I've never used that command line utility HTTPCOPY but it looks as though it'll do what you want!Code:[Files] Source: "HTTPCOPY.EXE"; DestDir : "{tmp}"; Flags: ignoreversion deleteafterinstall [Run] Filename: "{tmp}\HTTPCOPY.EXE"; Parameters: "h t t p : //blah.blah.com/file.exe";
We can't include the exe with our installation because we have to sign a distribution agreement with adobe unless this is the only solution.
Thanks for all your inputs. I'm still figuring out what to do next.
- Maggie
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks