InternetCrackUrl

Aus API-Wiki
Wechseln zu: Navigation, Suche
Declare Sub InternetCrackUrl Lib "wininet.dll" _
            Alias "InternetCrackUrlA" ( _
            ByVal lpszUrl As String, _
            ByVal dwUrlLength As Long, _
            ByVal dwFlags As Long, _
            ByRef lpUrlComponents As URL_COMPONENTSA)

Beispiel

Public Function GetURL(ByVal URL As String) As Boolean
Dim COMPONENTS As URL_COMPONENTS
Dim Buffer As String
Dim BufLen As Long
Const BufSize = 1024
      
GetURL = False
   
Buffer = Space$(BufSize)
BufLen = Len(Buffer)
If InternetCanonicalizeUrl(URL, Buffer, BufLen, ICU_BROWSER_MODE) Then
   URL = Left(Buffer, BufLen)
   With COMPONENTS
       .StructSize = Len(COMPONENTS)
       .Scheme = Space$(INTERNET_MAX_SCHEME_LENGTH)
       .SchemeLength = INTERNET_MAX_SCHEME_LENGTH
       .nScheme = InternetSchemeUnknown
       .HostName = Space$(INTERNET_MAX_HOST_NAME_LENGTH)
       .HostNameLength = INTERNET_MAX_HOST_NAME_LENGTH
       .nPort = 0
       .UserName = Space$(INTERNET_MAX_USER_NAME_LENGTH)
       .UserNameLength = INTERNET_MAX_USER_NAME_LENGTH
       .Password = Space$(INTERNET_MAX_PASSWORD_LENGTH)
       .PasswordLength = INTERNET_MAX_PASSWORD_LENGTH
       .URLPath = Space$(INTERNET_MAX_PATH_LENGTH)
       .UrlPathLength = INTERNET_MAX_PATH_LENGTH
       .ExtraInfo = Space$(BufSize)
       .ExtraInfoLength = BufSize
   End With
 
   GetURL = CBool(InternetCrackUrl(URL, Len(URL), ICU_ESCAPE, COMPONENTS))
   With COMPONENTS
       mvarScheme = Left$(.Scheme, .SchemeLength)
       mvarlScheme = .nScheme
       mvarHostName = Left$(.HostName, .HostNameLength)
       mvarUserName = Left$(.UserName, .UserNameLength)
       mvarPassword = Left$(.Password, .PasswordLength)
       mvarURLPath = Left$(.URLPath, .UrlPathLength)
       mvarURLExtraInfo = Left$(.ExtraInfo, .ExtraInfoLength)
       mvarPort = .nPort
   End With
       
End If
End Function