Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Looking for freee and fast URLDecode function
Message
De
29/04/2002 15:14:36
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Applications Internet
Divers
Thread ID:
00646395
Message ID:
00650545
Vues:
47
>Ed,
>Am I correct in thinking that WinInet.DLL has greater ubiquity than SHLWAPI.DLL?
>
>If this is true, then there are a bunch of URL manipulating functions. Specifically:
>
>BOOL InternetCanonicalizeUrl(
> LPCTSTR lpszUrl,
> LPTSTR lpszBuffer,
> LPDWORD lpdwBufferLength,
> DWORD dwFlags
>);
>

Yes, WININET.DLL is less shell version sensitive than SHLWAPI, but this function simply converts a URL intyo its canonical form, not what I think you're looking for. Rick Strahl's wwIPStuff has several wrappers for the Inet functgionality; I'd suggest using that.

>which if used with dwFlags = BitOR( ICU_DECODE , ICU_NO_ENCODE ) should give Andrus what he is looking for.
>
>The following code sample is off the top of my head, so no one should expect it to run as-is!:
Declare Integer InternetCanonicalizeUrl In WinInet.DLL ;
>   String @ cUrlToDecode ;
> , String @ cResultsBuffer ;
> , Integer @ iBufferLength ;
> , Integer iFlags
>
>Declare Integer GetLastError In Win32Api
>
>*- flags for InternetCanonicalizeUrl() and InternetCombineUrl() from WinInet.H
>
>#define ICU_NO_ENCODE   0x20000000  && Don't convert unsafe characters to escape sequence.
>#define ICU_DECODE      0x10000000  && Convert %XX escape sequences to characters.
>#define ICU_NO_META     0x08000000  && Don't convert .. etc. meta path sequences.
>#define ICU_ENCODE_SPACES_ONLY 0x04000000  && Encode spaces only.
>#define ICU_BROWSER_MODE 0x02000000 && Special encode/decode rules for browser.
>
>cUrlToDecode = "This%20is%20a%20test"
>
>iBufferLength = Len( cUrlToDecode )
>cResultsBuffer = Space( iBufferLength ) + Chr(0)
>cUrlToDecode = cUrlToDecode + Chr(0)
>iBufferLength = iBufferLength + 1
>
>iResult = InternetCanonicalizeUrl( ;
>            @cUrlToDecode ;
>          , @cResultsBuffer ;
>          , @iBufferLength ;
>          , BitOR( ICU_DECODE , ICU_NO_ENCODE ))
>
>TRUE = -1  && 0 for FALSE.
>If iResult == TRUE
>   Return Left( cResultsBuffer, iBufferLength )
>Endif
>Return "ERROR: " + Transform( GetLastError())
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform