Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
URL Encode API
Message
De
19/02/2004 12:16:55
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Titre:
Divers
Thread ID:
00878743
Message ID:
00878791
Vues:
17
>Is the an API call hiding somewhere that I can use to URL encode an argument string to send to a web page?
>
>? f( "test this?" ) && would return test%20this%3F
>
>I know that something like this has to exist because if you look at the LocationURL inside an IE object it comes back encoded. The problem is I can't actually call the Navigate() method until the arglist has been encoded.
>
>I'm looking for an API because it's got to be at least an order of magnitude faster than VFP code could do it.

To go along with Greg Reichert idea with VBScript you can use the ScriptControl if you don't want to use WSH
lo_Script = NEWOBJECT('scriptcontrol')
lo_Script.Language = "VBScript"
? lo_Script.Eval('escape("test this?")')
or you can make a VB Function
lc_code  = [Function Encode(pc_text)] + CHR(13) + CHR(10) + ;
           [	Encode = escape(pc_text)] + CHR(13) + CHR(10) + ;
           [End Function]
lo_Script = NEWOBJECT('scriptcontrol')
lo_Script.Language = "VBScript"
lo_Script.AddCode(lc_code)
? lo_Script.Run('Encode', "test this?")
*-- If you want to test speed
? lo_Script.Run('Encode', FILETOSTR(HOME()+ "FOXTOOLS.FLL"))
Charles

"The code knows no master." - Chuck Mautz
"Everybody is ignorant, only on different subjects." - Will Rogers
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform