CoInternetIsFeatureEnabled function
Determines whether the specified feature control is enabled.
Syntax
HRESULT CoInternetIsFeatureEnabled(
INTERNETFEATURELIST FeatureEntry,
_In_ DWORD dwFlags
);
Parameters
FeatureEntry
A feature control from the INTERNETFEATURELIST enumeration.
dwFlags [in]
Specifies where to get the feature control value from.
GET_FEATURE_FROM_THREAD (0x00000001)
The current thread.
GET_FEATURE_FROM_PROCESS (0x00000002)
The current process.
GET_FEATURE_FROM_REGISTRY (0x00000004)
Reserved. Do not use.
GET_FEATURE_FROM_THREAD_LOCALMACHINE (0x00000008)
The local machine zone.
GET_FEATURE_FROM_THREAD_INTRANET (0x00000010)
The intranet zone.
GET_FEATURE_FROM_THREAD_TRUSTED (0x00000020)
The trusted zone.
GET_FEATURE_FROM_THREAD_INTERNET (0x00000040)
The Internet zone.
GET_FEATURE_FROM_THREAD_RESTRICTED (0x00000080)
The restricted zone.
Return value
Returns one of the following values.
Return code | Description |
---|---|
S_OK | The feature is enabled. |
S_FALSE | The feature is disabled. |
E_FAIL | The FeatureEntry parameter is invalid. |
Remarks
The CoInternetIsFeatureEnabled function was introduced in Microsoft Internet Explorer 6 for Windows XP Service Pack 2 (SP2).
CoInternetIsFeatureEnabledForUrl is the recommended function to use for the FEATURE_ZONE_ELEVATION feature control, the FEATURE_MIME_SNIFFING feature control, and the FEATURE_WINDOW_RESTRICTIONS feature control.
Note Flags of the form GET_FEATURE_FROM_THREAD* (where "*" indicates zero or more characters) should only be used when the Feature entry is either FEATURE_LOCAL_MACHINE_LOCKDOWN or FEATURE_PROTOCOL_LOCKDOWN.
Examples
This code snippet uses CoInternetIsFeatureEnabled to check four features of Internet Explorer, and displays a message box that states whether the features are enabled under the current process.
WCHAR wszErrMsg[MAX_BUFFER_SIZE];
StringCchCopy(wszErrMsg, ARRAYSIZE(wszErrMsg), L"Current Status of Information Bar Features:\n");
HRESULT result;
result = CoInternetIsFeatureEnabled(FEATURE_SECURITYBAND,GET_FEATURE_FROM_PROCESS);
if (result==S_OK)
StringCchCat(wszErrMsg, ARRAYSIZE(wszErrMsg), L"\tInformation Bar=On\n");
else if (result==S_FALSE)
StringCchCat(wszErrMsg, ARRAYSIZE(wszErrMsg), L"\tInformation Bar=Off\n");
else
StringCchCat(wszErrMsg, ARRAYSIZE(wszErrMsg), L"\tInformation Bar=ERROR\n");
result = CoInternetIsFeatureEnabled(FEATURE_WEBOC_POPUPMANAGEMENT,GET_FEATURE_FROM_PROCESS);
if (result==S_OK)
StringCchCat(wszErrMsg, ARRAYSIZE(wszErrMsg), L"\tPopup Management=On\n");
else if (result==S_FALSE)
StringCchCat(wszErrMsg, ARRAYSIZE(wszErrMsg), L"\tPopup Management=Off\n");
else
StringCchCat(wszErrMsg, ARRAYSIZE(wszErrMsg), L"\tPopup Management=ERROR\n");
result = CoInternetIsFeatureEnabled(FEATURE_RESTRICT_FILEDOWNLOAD,GET_FEATURE_FROM_PROCESS);
if (result==S_OK)
StringCchCat(wszErrMsg, ARRAYSIZE(wszErrMsg), L"\tFile Restriction=On\n");
else if (result==S_FALSE)
StringCchCat(wszErrMsg, ARRAYSIZE(wszErrMsg), L"\tFile Restriction=Off\n");
else
StringCchCat(wszErrMsg, ARRAYSIZE(wszErrMsg), L"\tFile Restriction=ERROR\n");
result = CoInternetIsFeatureEnabled(FEATURE_RESTRICT_ACTIVEXINSTALL,GET_FEATURE_FROM_PROCESS);
if (result==S_OK)
StringCchCat(wszErrMsg, ARRAYSIZE(wszErrMsg), L"\tActiveX Restriction=On\n");
else if (result==S_FALSE)
StringCchCat(wszErrMsg, ARRAYSIZE(wszErrMsg), L"\tActiveX Restriction=Off\n");
else
StringCchCat(wszErrMsg, ARRAYSIZE(wszErrMsg), L"\tActiveX Restriction=ERROR\n");
MessageBox(wszErrMsg, L"Information Bar Feature Status Results", MB_OK);
Requirements
Minimum supported client |
Windows XP with SP2 |
Minimum supported server |
Windows Server 2003 |
Product |
Internet Explorer 6.0 |
Header |
Urlmon.h |
Library |
Urlmon.lib |
DLL |
Urlmon.dll |