6 out of 8 rated this helpful - Rate this topic

CoInternetSetFeatureEnabled function

[This documentation is preliminary and is subject to change.]

Applies to: desktop apps only

Enables or disables a specified feature control.

Syntax

HRESULT CoInternetSetFeatureEnabled(
  INTERNETFEATURELIST FeatureEntry,
  _In_  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. Can be one of the following values:

SET_FEATURE_ON_THREAD (0x00000001)

The current thread.

SET_FEATURE_ON_PROCESS (0x00000002)

The current process.

SET_FEATURE_IN_REGISTRY (0x00000004)

Reserved. Do not use.

SET_FEATURE_ON_THREAD_LOCALMACHINE (0x00000008)

The local machine zone.

SET_FEATURE_ON_THREAD_INTRANET (0x00000010)

The intranet zone.

SET_FEATURE_ON_THREAD_TRUSTED (0x00000020)

The trusted zone.

SET_FEATURE_ON_THREAD_INTERNET (0x00000040)

The Internet zone.

SET_FEATURE_ON_THREAD_RESTRICTED (0x00000080)

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.

Return codeDescription
S_OK

Success.

E_FAIL

FeatureEntry is invalid.

 

Remarks

The SET_FEATURE_ON_PROCESS flag is available for all values of INTERNETFEATURELIST except FEATURE_LOCALMACHINE_LOCKDOWN. All other values of dwFlags are available only when FeatureEntry is FEATURE_LOCALMACHINE_LOCKDOWN or FEATURE_PROTOCOL_LOCKDOWN.

Note  You cannot enable FEATURE_LOCALMACHINE_LOCKDOWN with this method, because doing so would bypass initialization that is based on whether this feature is enabled when a process starts. To correctly enable FEATURE_LOCALMACHINE_LOCKDOWN, you must set a Feature Control Key in the registry. For more information, see Introduction to Feature Controls.

The CoInternetSetFeatureEnabled function was introduced in Microsoft Internet Explorer 6 for Windows XP Service Pack 2 (SP2).

Examples

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;
    }

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

 

 

Build date: 3/14/2012

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
internet exploer 9

HRESULT CoInternetSetFeatureEnabled(
  INTERNETFEATURELIST FeatureEntry,
  __in  DWORD dwFlags,
  BOOL fEnable
);innstall exploer 9 then lock new manafest.exe

vb.net syntax
<SecurityCritical, SuppressUnmanagedCodeSecurity, DllImport("urlmon.dll", ExactSpelling:=True)> _
Public Shared Function CoInternetSetFeatureEnabled(ByVal featureEntry As Integer, ByVal dwFlags As Integer, ByVal fEnable As Boolean) As Integer
End Function
SET_FEATURE_ON_THREAD = DO_NOTHING_AT_ALL ?
SET_FEATURE_ON_THREAD doesn't seem to do anything at all, at least with IE7 + Vista and the various features that I have tried to toggle. The call succeeds but it changes nothing.

If you search the web for SET_FEATURE_ON_THREAD then (at the time of writing) you'll only find similar posts where people are saying it does nothing but SET_FEATURE_ON_PROCESS works.

If it doesn't work at all, or only works with certain features or certain versions of IE or something, then (of course) it be good to have it documented.


[jsudds.MSFT] SET_FEATURE_ON_THREAD (in all its forms) is only available for FEATURE_LOCALMACHINE_LOCKDOWN and FEATURE_PROTOCOL_LOCKDOWN. None of the other features can be set this way. I'll make sure the doc is updated to reflect this.