Newsgroups : Microsoft : microsoft.public.inetsdk.programming.wininet : 2007 Feb : Retrieving User Agent String with InternetQueryOption fails
| Subject: | Retrieving User Agent String with InternetQueryOption fails |
| Posted by: | key88..@gmail.com |
| Date: | 21 Feb 2007 11:06:00 |
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.