Autor Beitrag
reg107
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 36



BeitragVerfasst: Di 07.06.05 17:57 
Hallo,
ich hab folgende Funktion:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
function exists_url(URL: String): Boolean;
var
  Session, thefile: hInternet;
  index,CodeLength: cardinal;
  Code: array[1..20] of Char;
  res: PChar;
begin
  Result := False;
  Session := InternetOpen('InetURL:/1.0',INTERNET_OPEN_TYPE_PRECONFIG,nil,nil,0);
  if Assigned(session) then
  begin
    thefile := InternetOpenUrl(session, pchar(URL), nil, 0, INTERNET_FLAG_RELOAD,0);
    Index := 0;
    CodeLength := 10;
    HttpQueryInfo(thefile, HTTP_QUERY_STATUS_CODE, @Code, CodeLength, Index);
    res:= pchar(@Code);
    if res = '200' then
      Result := True;

    if Assigned(thefile) then
      InternetCloseHandle(thefile);
  end;
  InternetCloseHandle(session);
end;

ich möchte jetzt, dass eine überprüfung nach 10 Sekunden automatisch abgebrochen wird. wie mache ich das?

Grüße,
reg

Moderiert von user profile iconraziel: Code- durch Delphi-Tags ersetzt.
alzaimar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2889
Erhaltene Danke: 13

W2000, XP
D6E, BDS2006A, DevExpress
BeitragVerfasst: Di 07.06.05 18:00 
Mit nem Thread? Oder einem TTimer. Geht aber nur, wenn Du irgendwie deine Abfrage auch abbrechen kannst.
reg107 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 36



BeitragVerfasst: Di 07.06.05 18:04 
hmm, ich bin schon in einem thread. ich will die abfrage natürlich abbrechen, nur wie mach ich das?