k***@gmail.com
2007-02-21 19:06:00 UTC
Hello, I'm using the standard sample code provided with MSDN to
retrieve the value of the currnet User Agent string from WinInet:
DWORD dwSize;
InternetQueryOption(NULL,INTERNET_OPTION_USER_AGENT,NULL,&dwSize);
lpszData = new char[dwSize];
InternetQueryOption( NULL,
INTERNET_OPTION_USER_AGENT,
lpszData,&dwSize );
// Insert code here to use the user agent string data.
delete [] lpszData;
The first call to InternetQueryOption to get the appropriate size
fails with error code 12018: ERROR_INTERNET_INCORRECT_HANDLE_TYPE
If I preallocate the buffer and skip the call to retrieve the correct
size, I still get the same error.
Anyone know what is wrong here?? How can I just retrieve the User
Agent string that is the default? Thanks.
retrieve the value of the currnet User Agent string from WinInet:
DWORD dwSize;
InternetQueryOption(NULL,INTERNET_OPTION_USER_AGENT,NULL,&dwSize);
lpszData = new char[dwSize];
InternetQueryOption( NULL,
INTERNET_OPTION_USER_AGENT,
lpszData,&dwSize );
// Insert code here to use the user agent string data.
delete [] lpszData;
The first call to InternetQueryOption to get the appropriate size
fails with error code 12018: ERROR_INTERNET_INCORRECT_HANDLE_TYPE
If I preallocate the buffer and skip the call to retrieve the correct
size, I still get the same error.
Anyone know what is wrong here?? How can I just retrieve the User
Agent string that is the default? Thanks.