Information générale
Catégorie:
Fonctions Windows API
Hi Erik --
>>>
Having trouble getting a WinInet function to work, and wondered if anyone can see what I am doing wrong:
DECLARE INTEGER InternetQueryOption IN WinInet.dll ;
INTEGER hInternet, ;
STRING dwOption, ;
STRING @lpBuffer, ;
LONG @lpdwBufferLength
<<<
First off, if VFP differentiates between an INTEGER and a LONG (presumably 2 and 4 bytes, respectively?), the hInternet parameter should be a LONG. Under 9x, this change may have no practical result, but in NT failing to use the full 32bits of a handle will nearly always cause problems.
>>>
DECLARE INTEGER InternetOpen IN WININET.DLL ;
STRING, ;
INTEGER, ;
STRING, ;
STRING, ;
INTEGER
<<<
Ditto here.
>>>
hInternet = InternetOpen("EKraft Web Application", 0, NULL,NULL,0)
<<<
What's this call returning?
>>>
lpdwBufferLength = 0
lpBuffer = SPACE(0)
dwOption = NumToDWord(41)
?InternetQueryOption(hInternet, dwOption, @lpBuffer, @lpdwBufferLength)
41 is the value for a valid option as defined Wininet.h, and NumToDWord is a VFP function that does what its name implies. The call returns 0 (failed), and GetLastError returns the code for "Parameter is Incorrect"
<<<
(41 equates to INTERNET_OPTION_USER_AGENT, right?)
I immediately felt the zero-length buffer would be a problem, but in this case that should be okay, with the last parameter returning the correct length and a lasterror of "insufficient buffer."
I'm leaning, at the moment, towards the (presumably) 16-bit handle you're passing that's causing the incorrect parameter error. Make sense?
Later... Karl
.
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement