AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

FTP URL in Bestandteile splitten

Ein Thema von Alois · begonnen am 25. Jul 2005 · letzter Beitrag vom 23. Aug 2005
Antwort Antwort
Alois

Registriert seit: 23. Jul 2005
71 Beiträge
 
Delphi 10 Seattle Professional
 
#1

Re: FTP URL in Bestandteile splitten

  Alt 25. Jul 2005, 14:43
Vielen Dank für eure Antworten. Das ging aber flott...
Werde ich gleich mal ausprobieren.

Noch 'ne Frage:
Wie rufe ich die Funktion CrackUrl eigentlich auf und wie habe ich Zugriff auf die einzelnen Variablen??
Delphi-Quellcode:
type
   TEasyURLComponents = record
     Scheme, HostName: string;
     Port: Integer;
     User, Password, UrlPath, ExtraInfo: string;
   end;
procedure CrackURL(const URL: string; decode, escape: Boolean; var data: TEasyURLComponents );
var
  uc: TURLComponents;
  flags: Cardinal;
begin
  ZeroMemory(@uc, sizeof(uc));
  uc.dwStructSize := sizeof(TURLComponents);

  with data do
  begin
    SetLength(Scheme, 10);
    uc.lpszScheme := PChar(Scheme);
    uc.dwSchemeLength := Length(Scheme);

    SetLength(HostName, 200);
    uc.lpszHostName := PChar(HostName);
    uc.dwHostNameLength := Length(HostName);

    SetLength(User, 200);
    uc.lpszUserName := PChar(User);
    uc.dwUserNameLength := Length(User);

    SetLength(Password, 200);
    uc.lpszPassword := PChar(Password);
    uc.dwPasswordLength := Length(Password);

    SetLength(UrlPath, 1000);
    uc.lpszUrlPath := PChar(UrlPath);
    uc.dwUrlPathLength := Length(UrlPath);

    SetLength(ExtraInfo, 2000);
    uc.lpszExtraInfo := PChar(ExtraInfo);
    uc.dwExtraInfoLength:= Length(ExtraInfo);
  end;

  flags := 0;
  // Converts encoded characters back to their normal form.
  if decode then flags := flags or ICU_DECODE;

  // Converts all escape sequences (%xx) to their corresponding characters.
  if escape then flags := flags or ICU_ESCAPE;

  if not InternetCrackUrl(PChar(URL), Length(URL), flags, uc) then
    RaiseLastWin32Error;

  with data do
  begin
    SetLength(Scheme, uc.dwSchemeLength);
    SetLength(HostName, uc.dwHostNameLength);
    SetLength(User, uc.dwUserNameLength);
    SetLength(Password, uc.dwPasswordLength);
    SetLength(UrlPath, uc.dwUrlPathLength);
    SetLength(ExtraInfo, uc.dwExtraInfoLength);
    Port := uc.nPort;
  end;
end;
Greetz Alois
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 00:43 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz