Discussion:
Retrieving User Agent String with InternetQueryOption fails
(too old to reply)
k***@gmail.com
2007-02-21 19:06:00 UTC
Permalink
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.
Scherbina Vladimir
2007-03-08 12:08:25 UTC
Permalink
Report this problem to connect.microsoft.com

--Vladimir, Windows SDK MVP
Post by k***@gmail.com
Hello, I'm using the standard sample code provided with MSDN to
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.
k***@gmail.com
2007-04-16 09:27:22 UTC
Permalink
Post by Scherbina Vladimir
Report this problem to connect.microsoft.com
--Vladimir, Windows SDK MVP
Post by k***@gmail.com
Hello, I'm using the standard sample code provided with MSDN to
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.- Hide quoted text -
- Show quoted text -
Well, the connecft.microsoft.com group for Internet Explorer says it's
closed, then redirects me to the standard consumer page for IE. Gee,
that's nice of MSFT to decide there are no more bugs in IE.
Denis Logachev
2007-04-18 10:35:50 UTC
Permalink
On Mon, 16 Apr 2007 12:27:22 +0300, <***@gmail.com> wrote:

maybe this topic can help you?
http://www.codepieces.net/index.php/how-to-obtain-an-internet-explorer-u=
ser-agent/
Post by Scherbina Vladimir
Report this problem to connect.microsoft.com
--Vladimir, Windows SDK MVP
Post by k***@gmail.com
Hello, I'm using the standard sample code provided with MSDN to
DWORD dwSize;
InternetQueryOption(NULL,INTERNET_OPTION_USER_AGENT,NULL,&dwSize);
lpszData =3D 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 corre=
ct
Post by Scherbina Vladimir
Post by k***@gmail.com
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.- Hide quoted text -
- Show quoted text -
Well, the connecft.microsoft.com group for Internet Explorer says it's=
closed, then redirects me to the standard consumer page for IE. Gee,
that's nice of MSFT to decide there are no more bugs in IE.
-- =

Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Loading...