Closed Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: question on TFileStream (Inno Setup)

  1. #1
    mainguy is offline Newbie
    Join Date
    Sep 2009
    Posts
    5
    Rep Power
    0

    question on TFileStream (Inno Setup)

    Hello,

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

    My code:
    Code:
    XMLHTTP := CreateOleObject('MSXML2.ServerXMLHTTP');
    XMLHTTP.Open('GET', myUrl, False);
    XMLHTTP.Send();
    ...
    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?

    Thanks,
    Maggie
    Last edited by Jaan; 09-18-2009 at 05:06 AM. Reason: Please use code tags when you are posting your codes !

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    Join Date
    Jul 2006
    Posts
    16,491
    Blog Entries
    75
    Rep Power
    143

    Re: question on TFileStream (Inno Setup)

    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.
    Programming is a branch of mathematics.
    My CodeCall Blog | My Personal Blog

  4. #3
    mainguy is offline Newbie
    Join Date
    Sep 2009
    Posts
    5
    Rep Power
    0

    Re: question on TFileStream (Inno Setup)

    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

  5. #4
    Join Date
    Jul 2006
    Posts
    16,491
    Blog Entries
    75
    Rep Power
    143

    Re: question on TFileStream (Inno Setup)

    I think Count is optional. It would probably be something like Write(XMLHTTP.REsponseBody)
    Programming is a branch of mathematics.
    My CodeCall Blog | My Personal Blog

  6. #5
    mainguy is offline Newbie
    Join Date
    Sep 2009
    Posts
    5
    Rep Power
    0

    Re: question on TFileStream (Inno Setup)

    No, it will give a compiler error: "Invalid number of parameters"

  7. #6
    Join Date
    Jul 2006
    Posts
    16,491
    Blog Entries
    75
    Rep Power
    143

    Re: question on TFileStream (Inno Setup)

    Based on this: Delphi: Reading and writing a file to and from a string
    Write(XMLHTTP.REsponseBody,Length(XMLHTTP.REsponse Body))
    Programming is a branch of mathematics.
    My CodeCall Blog | My Personal Blog

  8. #7
    mainguy is offline Newbie
    Join Date
    Sep 2009
    Posts
    5
    Rep Power
    0

    Re: question on TFileStream (Inno Setup)

    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

    Code:
    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:

    Code:
    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?

    Thanks,
    Maggie
    Last edited by Jaan; 09-19-2009 at 09:55 AM. Reason: Please use code tags when you are posting your codes !

  9. #8
    Join Date
    Jul 2006
    Posts
    16,491
    Blog Entries
    75
    Rep Power
    143

    Re: question on TFileStream (Inno Setup)

    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
    Programming is a branch of mathematics.
    My CodeCall Blog | My Personal Blog

  10. #9
    The Cat is offline Newbie
    Join Date
    Oct 2009
    Posts
    2
    Rep Power
    0

    Re: question on TFileStream (Inno Setup)

    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:

    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";
    Having said that, I've never used that command line utility HTTPCOPY but it looks as though it'll do what you want!

  11. #10
    mainguy is offline Newbie
    Join Date
    Sep 2009
    Posts
    5
    Rep Power
    0

    Re: question on TFileStream (Inno Setup)

    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

Closed Thread
Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Write into a string in inno set up
    By nla1kor in forum Pascal and Delphi
    Replies: 0
    Last Post: 11-16-2010, 09:23 PM
  2. Replies: 0
    Last Post: 05-20-2010, 03:51 PM
  3. Setup
    By JakeWindu in forum C# Programming
    Replies: 2
    Last Post: 02-02-2010, 08:33 AM
  4. Win-XP Setup
    By arifsandwip in forum Computer Software/OS
    Replies: 7
    Last Post: 04-12-2009, 08:25 PM
  5. How to setup DMD
    By Termana in forum Tutorials
    Replies: 2
    Last Post: 01-02-2009, 05:24 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts