CWebView::SetOption Method  
 
BOOL SetOption(
  DWORD dwOption,  
  BOOL bEnable  
);

The SetOption method enables or disables a specific option.

Parameters

dwOption
An unsigned integer which specifies the option to be changed. Refer to the Options documentation for the list of available options. Only a single option may be specified; you cannot combine multiple option bitflags when calling this method.
bEnable
An integer value which specifies if the option should be enabled. If this value is non-zero, the option is enabled. If the value is zero, the option is disabled.

Return Value

If the method succeeds, the return value is non-zero. If the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

The SetOption method enables or disables a single option for the browser instance attached to the specified host window. Each option corresponds to a specific feature or behavior such as scripting, zoom controls, developer tools, or privacy settings. Only one option bitflag may be specified in the dwOption parameter when calling this method. It is not valid to combine multiple option flags with a bitwise OR. If you need to change the state of multiple options, call this method once for each option you want to modify.

Some options can be changed dynamically at runtime, while others only take effect during creation of the browser control. For example, options related to scripting, dialogs, or developer tools can typically be toggled while the control is active. In contrast, options that affect the user data folder, profile isolation, or privacy mode must be set at creation time using Attach or Create. Attempting to change those options will fail once the browser control has been created.

If the method succeeds, the option state will be updated immediately. The application can verify the new state by calling GetOption or by retrieving all current options with GetAllOptions. If the method fails, no changes are made and extended error information can be obtained with GetLastError.

Requirements

Minimum Desktop Platform: Windows 7 Service Pack 1
Minimum Server Platform: Windows Server 2008 R2 Service Pack 1
Header File: cstools12.h
Import Library: cshtmv12.lib

See Also