Einzelnen Beitrag anzeigen

Benutzerbild von toms
toms
(CodeLib-Manager)

Registriert seit: 10. Jun 2002
4.648 Beiträge
 
Delphi XE Professional
 
#7

Re: funktion liest den wert zu früh

  Alt 25. Mai 2005, 08:08
Delphi-Quellcode:
private
  GR:double;
  getDis(start:string):double;


function tformMain.getDis(start:string): Double;
begin
  //....
  wb2.Navigate(ExtractFilePath(application.ExeName)+'rechne.htm');
  WaitForBrowser(wb2);
  berechnenclick; // klickt einen button auf der geladen seite 'rechne.htm'
  WaitForBrowser(wb2);
  Result := ExtractGR(wb2.LocationURL);
end;

function TFormMain.ExtractGR(url: OleVariant): Double;
var
  s, s2: string;
  i1, i2: integer;
begin
  if pos('s=', url) > 0 then
  begin
    WB_GetHTMLCode(wb2, dis);
    s := dis.Text;
    i1 := pos('edl', s) + 12;
    i2 := pos('//', s) - 1;
    s2 := copy(s, i1, i2 - i1);
    try
      GR := strtofloat(s2);
    except
      GR := 0;
    end;
  end;
end;
Thomas
  Mit Zitat antworten Zitat