Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
WinInet troubleshooting
Message
From
07/04/2000 06:31:26
 
 
To
06/04/2000 14:45:19
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00356440
Message ID:
00356713
Views:
19
>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
>
>DECLARE INTEGER InternetOpen IN WININET.DLL ;
> STRING, ;
> INTEGER, ;
> STRING, ;
> STRING, ;
> INTEGER
>
>hInternet = InternetOpen("EKraft Web Application", 0, NULL,NULL,0)
>
>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"
>
>FWIW, the C declaration for InternetQueryoption is:
>
>BOOL InternetQueryOption(
>    IN HINTERNET hInternet,
>    IN DWORD dwOption,
>    OUT LPVOID lpBuffer,
>    IN OUT LPDWORD lpdwBufferLength
>);
>
>

DECLARE SHORT InternetQueryOption IN WinInet.DLL
  INTEGER hInternet, ;
  INTEGER dwOption ;
  STRING @ lpBuffer
  INTEGER @ lpdwBufferLength

I might be inclined to allocate a static block using CLSHEAP if the buffer 
might contain self-referential pointers, in which case, I'd allocate a block 
and pass the pointer:


DECLARE SHORT InternetQueryOption IN WinInet.DLL
  INTEGER hInternet, ;
  INTEGER dwOption ;
  INTEGER lpBuffer
  INTEGER @ lpdwBufferLength
SET PROC TO CLSHEAP ADDITIVE
oHeap = CREATEOBJ('Heap')
nBuffLen = 4096
nBuffPtr = oHeap.Alloc(nBuffLen)
dwOption = NumToDWord(41)
? InternetQueryOption(hInternet, dwOption, @nBuffPtr, @nBuffLen)
You could then copt back the buffer using the reutrned pointer.


>Anyone see what I could be doing wrong?
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
Previous
Reply
Map
View

Click here to load this message in the networking platform