CoInternetSetFeatureEnabled Function

  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.
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.
fEnable
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_OKSuccess.
E_FAILFeatureEntry 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 Implementationurlmon.dll
Custom ImplementationNo
HeaderUrlmon.h
Import libraryUrlmon.lib
Minimum availabilityInternet Explorer 6.0
Minimum operating systemsWindows XP SP2
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值