Hi I'm trying to download a program version number from a website using HttpCli and getting an AV where marked "<<<< AV" in the code below. My code is based in the HttpTst demo program, adapted (and stuffed up!) for my needs. I looks like this:- procedure TSplashForm.FormCreate(Sender: TObject); var sVersion: string; begin {Some screen values come from Project | Options -> VersionInfo } bCanHide := False; ... sVersion := Common.GetVersionInfoByKey('FileVersion'); ... HttpCli.URL := URL.Caption; sWebVersion := ''; try HttpCli.Get; except sWebVersion := 'Not found'; bCanHide := True; HttpCliDocEnd(nil); { This will close the file } Exit; end; end;
procedure TSplashForm.HttpCliDocBegin(Sender: TObject); begin try HttpCli.RcvdStream := TMemoryStream.Create; except sWebVersion := 'Not found'; bCanHide := True; end; end; procedure TSplashForm.HttpCliDocEnd(Sender: TObject); begin if HttpCli.RcvdStream <> nil then begin HttpCli.RcvdStream.Free; HttpCli.RcvdStream := nil; end; end; procedure TSplashForm.HttpCliRequestDone(Sender: TObject; RqType: THttpRequest; ErrCode: Word); var i: integer; sl: TStringList; b: Boolean; sReleaseDate: string; begin if ErrCode = 0 then begin sl := TStringList.Create; sl.LoadFromStream(HttpCli.RcvdStream); <<<< AV here b := False; for i := 0 to sl.Count - 1 do begin if Copy(sl[i], 1, 8) = 'Version=' then begin sWebVersion := Copy(sl[i], 9, 15); sNewVersion := VersionStr(sWebVersion); b := True; end else if Copy(sl[i], 1, 12) = 'ReleaseDate=' then sReleaseDate := Copy(sl[i], 13, 20); end; if b and (sNewVersion > sThisVersion) then begin MessageDlg('There is a new version of the Aspect Property Manager available:-' + #13#10#13#10'Version: ' + sWebVersion + #13#10'Release Date: ' + sReleaseDate + #13#10#13#10'You can download this new version ' + 'by going to "Help>Download New Version" on the main screen menu', mtWarning, [mbOK], 0); end; bCanHide := True; end else begin sWebVersion := 'Not found'; bCanHide := True; end; end; What am I doing wrong? -- Jeff Cook "The Cooks" Oasis The Cooks Ltd Phone: +682 28 213 Skype: jeffraro www.cookislandsoasis.com <http://www.cookislandsoasis.com/> -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be