ObtainUserAgentString function
Retrieves the User-Agent HTTP request header string that is currently being used.
Syntax
HRESULT ObtainUserAgentString(
_In_ DWORD dwOption = 0,
_Out_ LPCSTR *pcszUAOut,
_Out_ DWORD *cbSize
);
Parameters
dwOption [in]
7 | UAS_EXACTLEGACY (0x1000)
Internet Explorer 7 in exact legacy mode.
7
Internet Explorer 7 in compatible mode.
8
Internet Explorer 8.
0
Default. As currently set.
pcszUAOut [out]
Pointer to a string value that contains the User-Agent request header string that is currently being used.
cbSize [out]
Pointer to an unsigned long integer value that contains the length of the User-Agent request header string.
Return value
Returns one of the following values:
Return code | Description |
---|---|
E_INVALIDARG | One of the parameters is invalid. |
E_OUTOFMEMORY | The operation ran out of memory. |
NOERROR | The function completed successfully. |
Remarks
Passing a bitwise OR of 7 | UAS_EXACTLEGACY to dwOption specifies Internet Explorer 7 running in exact legacy mode, as opposed to compatible mode.
Internet Explorer 8. dwOption is no longer reserved and must have one of the required values.
Examples
The following example is a User-Agent HTTP request header sent by Internet Explorer 7 on Windows XP with Office:
Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; InfoPath.1)
Requirements
Minimum supported client |
Windows XP |
Minimum supported server |
Windows 2000 Server |
Product |
Internet Explorer 4.0 |
Header |
Urlmon.h |
Library |
Urlmon.lib |
DLL |
Urlmon.dll |
See also
Reference
Conceptual