http://msdn.microsoft.com/zh-cn/library/ms537168(en-us,VS.85).aspx
CoInternetSetFeatureEnabled Function
Enables or disables a specified feature control.
Syntax
HRESULT CoInternetSetFeatureEnabled(
INTERNETFEATURELIST FeatureEntry, DWORD dwFlags, BOOL fEnable );
Parameters
FeatureEntry
- A value from the INTERNETFEATURELIST enumeration that indicates the feature control to enable or disable.
dwFlags- [in] Specifies where to set the feature control value.
fEnable
SET_FEATURE_ON_THREAD
- The current thread.
SET_FEATURE_ON_PROCESS
- The current process.
SET_FEATURE_IN_REGISTRY
- Reserved. Do not use.
SET_FEATURE_ON_THREAD_LOCALMACHINE
- The local machine zone.
SET_FEATURE_ON_THREAD_INTRANET
- The intranet zone.
SET_FEATURE_ON_THREAD_TRUSTED
- The trusted zone.
SET_FEATURE_ON_THREAD_INTERNET
- The Internet zone.
SET_FEATURE_ON_THREAD_RESTRICTED
- The restricted zone.
- A BOOL that indicates that the feature control specified by FeatureEntry is enabled when fEnable is TRUE.
Return Value
Returns one of the following values.
S_OK Success. E_FAIL FeatureEntry is invalid.
Remarks
The CoInternetSetFeatureEnabled function was introduced in Microsoft Internet Explorer 6 for Microsoft Windows XP Service Pack 2 (SP2).
Example
This code snippet enables pop-up management behavior for the process. The code is placed inside an application that uses the WebBrowser Control before the navigation command.
LRESULT lr = 0; INTERNETFEATURELIST featureToEnable = FEATURE_WEBOC_POPUPMANAGEMENT; if (SUCCEEDED(CoInternetSetFeatureEnabled(featureToEnable, SET_FEATURE_ON_PROCESS, true))) { //Check to make sure that the API worked as expected if (FAILED(CoInternetIsFeatureEnabled(featureToEnable,SET_FEATURE_ON_PROCESS))) { lr = 2; } } else { //The API returned an error while enabling pop-up management lr = 1; }
Function Information
Stock Implementation urlmon.dll Custom Implementation No Header Urlmon.h Import library Urlmon.lib Minimum availability Internet Explorer 6.0 Minimum operating systems Windows XP SP2