Redigeeri

Jagamisviis:


CHtmlView class

Provides the functionality of the WebBrowser control within the context of MFC's document/view architecture.

Syntax

class CHtmlView : public CFormView

Members

Public Methods

Name Description
CHtmlView::Create Creates the WebBrowser control.
CHtmlView::CreateControlSite Overridable used to create a control site instance to host a control on the form.
CHtmlView::ExecFormsCommand Executes the specified command using the IOleCommandTarget::Exec method.
CHtmlView::ExecWB Executes a command.
CHtmlView::GetAddressBar Determines if the Internet Explorer object's address bar is visible. (WebBrowser control ignores; Internet Explorer only.)
CHtmlView::GetApplication Retrieves an application object representing the application that contains the current instance of the Internet Explorer application.
CHtmlView::GetBusy Retrieves a value indicating whether a download or other activity is still in progress.
CHtmlView::GetContainer Retrieves the container of the WebBrowser control.
CHtmlView::GetFullName Retrieves the full name, including the path, of the resource displayed in the web browser. (WebBrowser control ignores; Internet Explorer only.)
CHtmlView::GetFullScreen Indicates whether the WebBrowser control is operating in full-screen mode or in normal window mode.
CHtmlView::GetHeight Retrieves the height of the Internet Explorer main window.
CHtmlView::GetHtmlDocument Retrieves the active HTML document.
CHtmlView::GetLeft Retrieves the screen coordinate of the left edge of the Internet Explorer main window.
CHtmlView::GetLocationName Retrieves the name of the resource that WebBrowser is currently displaying
CHtmlView::GetLocationURL Retrieves the URL of the resource that WebBrowser is currently displaying.
CHtmlView::GetMenuBar Retrieves a value that determines whether the menu bar is visible.
CHtmlView::GetOffline Retrieves a value that determines whether the control is offline.
CHtmlView::GetParentBrowser Retrieves a pointer to the IDispatch interface. For more information, see Implementing the IDispatch Interface.
CHtmlView::GetProperty Retrieves the current value of a property associated with the given object.
CHtmlView::GetReadyState Retrieves the ready state of the web browser object.
CHtmlView::GetRegisterAsBrowser Indicates whether the WebBrowser control is registered as a top-level browser for target name resolution.
CHtmlView::GetRegisterAsDropTarget Indicates whether the WebBrowser control is registered as a drop target for navigation.
CHtmlView::GetSilent Indicates whether any dialog boxes can be shown.
CHtmlView::GetSource The HTML source code of the web page.
CHtmlView::GetStatusBar Indicates whether the Internet Explorer's status bar is visible. (WebBrowser control ignores; Internet Explorer only.)
CHtmlView::GetTheaterMode Indicates whether the WebBrowser control is in theater mode.
CHtmlView::GetToolBar Retrieves a value that determines whether the toolbar is visible.
CHtmlView::GetTop Retrieves the screen coordinate of the top edge of the Internet Explorer main window.
CHtmlView::GetTopLevelContainer Retrieves a value indicating whether the current object is the top-level container of the WebBrowser control.
CHtmlView::GetType Retrieves the type name of the document object.
CHtmlView::GetVisible Retrieves a value indicating whether the object is visible or hidden.
CHtmlView::GetWidth Retrieves the width of the Internet Explorer main window.
CHtmlView::GoBack Navigates to the previous item in the history list.
CHtmlView::GoForward Navigates to the next item in the history list.
CHtmlView::GoHome Navigates to the current home or start page.
CHtmlView::GoSearch Navigates to the current search page.
CHtmlView::LoadFromResource Loads a resource in the WebBrowser control.
CHtmlView::Navigate Navigates to the resource identified by a URL.
CHtmlView::Navigate2 Navigates to the resource identified by a URL, or to the file identified by a full path.
CHtmlView::OnBeforeNavigate2 Called before a navigation operation occurs in the given WebBrowser (on either a window or frameset element).
CHtmlView::OnCommandStateChange Called to notify an application that the enabled state of a web browser command has changed.
CHtmlView::OnDocumentComplete Called to notify an application that a document has reached the READYSTATE_COMPLETE state.
CHtmlView::OnDocWindowActivate Called from the Internet Explorer or MSHTML implementation of IOleInPlaceActiveObject::OnDocWindowActivate, which notifies the active in-place object when the container's document window is activated or deactivated.
CHtmlView::OnDownloadBegin Called to notify an application that a navigation operation is beginning.
CHtmlView::OnDownloadComplete Called when a navigation operation finished, was halted, or failed.
CHtmlView::OnEnableModeless Called to enable or disable modeless dialog boxes when the container creates or destroys a modal dialog box.
CHtmlView::OnFilterDataObject Called on the host by Internet Explorer or MSHTML to allow the host to replace Internet Explorer or MSHTML's data object.
CHtmlView::OnFrameWindowActivate Called from IOleInPlaceActiveObject::OnFrameWindowActivate to notify the object when the container's top-level frame window is activated or deactivated.
CHtmlView::OnFullScreen Called when the FullScreen property has changed.
CHtmlView::OnGetDropTarget Called by Internet Explorer or MSHTML when it's being used as a drop target to allow the host to supply an alternative IDropTarget.
CHtmlView::OnGetExternal Called by Internet Explorer or MSHTML to obtain the host's IDispatch interface.
CHtmlView::OnGetHostInfo Retrieves the UI capabilities of the Internet Explorer or MSHTML host.
CHtmlView::OnGetOptionKeyPath Returns the registry key under which Internet Explorer or MSHTML stores user preferences.
CHtmlView::OnHideUI Called when Internet Explorer or MSHTML removes its menus and toolbars.
CHtmlView::OnMenuBar Called when the MenuBar property has changed.
CHtmlView::OnNavigateComplete2 Called after navigation to a hyperlink completes (on either a window or frameset element).
CHtmlView::OnNavigateError Called by the framework if navigation to a hyperlink fails.
CHtmlView::OnNewWindow2 Called when a new window is to be created for displaying a resource.
CHtmlView::OnProgressChange Called to notify an application that the progress of a download operation has been updated.
CHtmlView::OnPropertyChange Called to notify an application that the PutProperty method has changed the value of a property.
CHtmlView::OnQuit Called to notify an application that the Internet Explorer application is ready to quit. (Applies to Internet Explorer only)
CHtmlView::OnResizeBorder Called from the Internet Explorer or MSHTML implementation of IOleInPlaceActiveObject::ResizeBorder, which alerts the object that it needs to resize its border space.
CHtmlView::OnShowContextMenu Called from Internet Explorer or MSHTML when it's about to show its context menu.
CHtmlView::OnShowUI Called before Internet Explorer or MSHTML displays its menus and toolbars.
CHtmlView::OnStatusBar Called when the StatusBar property has changed.
CHtmlView::OnStatusTextChange Called to notify an application that the text of the status bar associated with the WebBrowser control has changed.
CHtmlView::OnTheaterMode Called when the TheaterMode property has changed.
CHtmlView::OnTitleChange Called to notify an application if the title of a document in the WebBrowser control becomes available or changes.
CHtmlView::OnToolBar Called when the ToolBar property has changed.
CHtmlView::OnTranslateAccelerator Called by Internet Explorer or MSHTML when IOleInPlaceActiveObject::TranslateAccelerator or IOleControlSite::TranslateAccelerator is called to process menu accelerator-key messages from the container's message queue.
CHtmlView::OnTranslateUrl Called by Internet Explorer or MSHTML to allow the host an opportunity to modify the URL to be loaded.
CHtmlView::OnUpdateUI Notifies the host that the command state has changed.
CHtmlView::OnVisible Called when the window for the WebBrowser control should be shown/hidden.
CHtmlView::PutProperty Sets the value of a property associated with the given object.
CHtmlView::QueryFormsCommand Queries for the status of one or more commands generated by user interface events.
CHtmlView::QueryStatusWB Queries the status of a command being processed by the WebBrowser control.
CHtmlView::Refresh Reloads the current file.
CHtmlView::Refresh2 Reloads the current file and optionally prevents the pragma:nocache header from being sent.
CHtmlView::SetAddressBar Shows or hides the Internet Explorer object's address bar. (WebBrowser control ignores; Internet Explorer only.)
CHtmlView::SetFullScreen Sets a value to determine whether the control is operating in full-screen mode or in normal window mode. (WebBrowser control ignores; Internet Explorer only.)
CHtmlView::SetHeight Sets the height of the Internet Explorer main window.
CHtmlView::SetLeft Sets the horizontal position of the Internet Explorer main window.
CHtmlView::SetMenuBar Sets a value to determine whether the control's menu bar is visible. (WebBrowser control ignores; Internet Explorer only.)
CHtmlView::SetOffline Sets a value to determine whether the control is offline.
CHtmlView::SetRegisterAsBrowser Sets a value indicating whether the WebBrowser control is registered as a top-level browser for target name resolution.
CHtmlView::SetRegisterAsDropTarget Sets a value indicating whether the WebBrowser control is registered as a drop target for navigation.
CHtmlView::SetSilent Sets a value to determine whether the control will display dialog boxes.
CHtmlView::SetStatusBar Sets a value to determine whether the Internet Explorer's status bar is visible. (WebBrowser control ignores; Internet Explorer only.)
CHtmlView::SetTheaterMode Sets a value indicating whether the WebBrowser control is in theater mode.
CHtmlView::SetToolBar Sets a value to determine whether the control's toolbar is visible. (WebBrowser control ignores; Internet Explorer only.)
CHtmlView::SetTop Sets the vertical position of the Internet Explorer main window.
CHtmlView::SetVisible Sets a value indicating whether the object is visible or hidden.
CHtmlView::SetWidth Sets the width of the Internet Explorer main window.
CHtmlView::Stop Stops opening a file.

Remarks

The WebBrowser control is a window in which the user can browse sites on the World Wide Web, and folders in the local file system and on a network. The WebBrowser control supports hyperlinking, Uniform Resource Locator (URL) navigation, and maintains a history list.

Using the CHtmlView Class in an MFC Application

In the standard MFC framework application (either SDI or MDI based), the view object is commonly derived from a specialized set of classes. These classes, all derived from CView, provide specialized functionality beyond that provided by CView.

Basing the application's view class on CHtmlView provides the view with the WebBrowser control. This effectively makes the application a web browser. The preferred method of creating a web browser-style application is to use the MFC Application Wizard, and specify CHtmlView as the view class. For more information on implementing and using the WebBrowser control within MFC applications, see Creating a Web Browser-Style Application.

Note

The WebBrowser ActiveX control (and therefore CHtmlView) is available only to programs running under Windows NT versions 4.0 or later, in which Internet Explorer 4.0 or later has been installed.

CHtmlView is designed for applications that access the Web (and/or HTML documents). The following CHtmlView member functions apply to the Internet Explorer application only. These functions will succeed on the WebBrowser control, but they'll have no visible effect.

Inheritance Hierarchy

CObject
CCmdTarget
CWnd
CView
CScrollView
CFormView

CHtmlView

Requirements

Header: afxhtml.h

CHtmlView::Create

Call this member function to create a WebBrowser control or container for the Internet Explorer executable.

virtual BOOL Create(
    LPCTSTR lpszClassName,
    LPCTSTR lpszWindowName,
    DWORD dwStyle,
    const RECT& rect,
    CWnd* pParentWnd,
    UINT nID,
    CCreateContext* pContext = NULL);

Parameters

lpszClassName
Points to a null-terminated character string that names the Windows class. The class name can be any name registered with the AfxRegisterWndClass global function or the RegisterClass Windows function. If NULL, uses the predefined default CFrameWnd attributes.

lpszWindowName
Points to a null-terminated character string that represents the window name.

dwStyle
Specifies the window style attributes. By default, the WS_VISIBLE and WS_CHILD Windows styles are set.

rect
A reference to a RECT structure specifying the size and position of the window. The rectDefault value allows Windows to specify the size and position of the new window.

pParentWnd
A pointer to the parent window of the control.

nID
The ID number of the view. By default, set to AFX_IDW_PANE_FIRST.

pContext
A pointer to a CCreateContext. NULL by default.

CHtmlView::CreateControlSite

Overridable used to create a control site instance to host a control on the form.

virtual BOOL CreateControlSite(
    COleControlContainer* pContainer,
    COleControlSite** ppSite,
    UINT nID,
    REFCLSID clsid);

Parameters

pContainer
A pointer to a COleControlContainer object containing the control.

ppSite
A pointer to a pointer to a COleControlSite object, providing the site for the control.

nID
The identifier of the control to be hosted.

clsid
The CLSID of the control to be hosted

Return Value

Returns TRUE on success, FALSE on failure.

Remarks

You can override this member function to return an instance of your own control site class.

CHtmlView::ExecFormsCommand

Executes the specified command using the IOleCommandTarget::Exec method.

HRESULT ExecFormsCommand(
    DWORD dwCommandID,
    VARIANT* pVarIn,
    VARIANT* pVarOut);

Parameters

dwCommandID
The command to be executed. This command must belong to the CMDSETID3_Forms3 group.

pVarIn
Pointer to a VARIANT structure containing input arguments. Can be NULL.

pVarOut
Pointer to a VARIANT structure to receive command output. Can be NULL.

Return Value

A standard HRESULT value. For a complete listing of possible values, see IOleCommandTarget::Exec in the Windows SDK.

Remarks

ExecFormsCommand implements the behavior of the IOleCommandTarget::Exec method.

CHtmlView::ExecWB

Call this member function to execute a command in the WebBrowser or Internet Explorer.

void ExecWB(
    OLECMDID cmdID,
    OLECMDEXECOPT cmdexecopt,
    VARIANT* pvaIn,
    VARIANT* pvaOut);

Parameters

cmdID
The command to execute.

cmdexecopt
The options set for executing the command.

pvaIn
A variant used for specifying command input arguments.

pvaOut
A variant used for specifying command output arguments.

Remarks

See IWebBrowser2::ExecWB in the Windows SDK.

CHtmlView::GetAddressBar

Call this member function to retrieve Internet Explorer's address bar.

BOOL GetAddressBar() const;

Return Value

Nonzero if the address bar is visible; otherwise zero.

Remarks

Applies to Internet Explorer. If you use this call with a WebBrowser control, it will return no error, but it will ignore this call.

CHtmlView::GetApplication

Call this member function to retrieve the automation object supported by the application that contains the WebBrowser control.

LPDISPATCH GetApplication() const;

Return Value

A pointer to the IDispatch interface of the active document object. For more information, see Implementing the IDispatch Interface.

Remarks

Applies to Internet Explorer and WebBrowser.

CHtmlView::GetBusy

Call this member function to determine whether the WebBrowser control is engaged in a navigation or downloading operation.

BOOL GetBusy() const;

Return Value

Nonzero if the web browser is busy; otherwise zero.

Remarks

Applies to Internet Explorer and WebBrowser.

CHtmlView::GetContainer

Call this member function to retrieve an object that evaluates to the container of the web browser.

LPDISPATCH GetContainer() const;

Return Value

A pointer to the IDispatch interface of the active document object.

Remarks

Applies to Internet Explorer and WebBrowser.

CHtmlView::GetFullName

Call this member function to retrieve the full path of the file that Internet Explorer is currently displaying.

CString GetFullName() const;

Return Value

A CString object containing the path and name of the currently displayed file. If no path and filename exist, GetFullName returns an empty CString.

Remarks

Applies to Internet Explorer. If you use this call with a WebBrowser control, it will return no error, but it will ignore this call.

CHtmlView::GetFullScreen

Call this member function to determine whether the WebBrowser control is operating in full-screen mode or in normal window mode.

BOOL GetFullScreen() const;

Return Value

Nonzero if the WebBrowser is operating in full-screen mode; otherwise zero.

Remarks

In full-screen mode, the Internet Explorer main window is maximized and the status bar, toolbar, menu bar, and title bar are hidden.

Applies to Internet Explorer and WebBrowser.

CHtmlView::GetHeight

Call this member function to retrieve the height, in pixels, of the WebBrowser control's frame window.

long GetHeight() const;

Return Value

The control's frame window height, in pixels.

CHtmlView::GetHtmlDocument

Call this member function to retrieve the HTML document for the active document.

LPDISPATCH GetHtmlDocument() const;

Return Value

A pointer to the IDispatch interface of the active document object.

Remarks

Applies to Internet Explorer and WebBrowser.

CHtmlView::GetLeft

Call this member function to retrieve the distance between the internal left edge of the WebBrowser control and the left edge of its container.

long GetLeft() const;

Return Value

The left-edge distance, in pixels.

Remarks

Applies to Internet Explorer and WebBrowser.

CHtmlView::GetLocationName

Call this member function to get the name of the resource being displayed in the WebBrowser.

CString GetLocationName() const;

Return Value

A CString object containing the name of the resource currently displayed in the WebBrowser.

Remarks

If the resource is an HTML page on the World Wide Web, the name is the title of that page. If the resource is a folder or file on the network or local computer, the name is the UNC or full path of the folder or file.

Applies to Internet Explorer and WebBrowser.

CHtmlView::GetLocationURL

Call this member function to retrieve the URL of the resource that the WebBrowser control is currently displaying.

CString GetLocationURL() const;

Return Value

A CString object containing the URL of the resource currently displayed in the WebBrowser.

Remarks

If the resource is a folder or file on the network or local computer, the name is the UNC or full path of the folder or file.

Applies to Internet Explorer and WebBrowser.

CHtmlView::GetMenuBar

Call this member function to determine whether the menu bar is visible.

BOOL GetMenuBar() const;

Return Value

Nonzero if the menu bar is visible; otherwise zero.

Remarks

Applies to Internet Explorer and WebBrowser.

CHtmlView::GetOffline

Call this member function to determine whether the web browser is operating offline.

BOOL GetOffline() const;

Return Value

Nonzero if the web browser is currently offline; otherwise zero.

Remarks

Applies to Internet Explorer and WebBrowser.

CHtmlView::GetParentBrowser

Call this member function to retrieve a pointer to the parent object of the WebBrowser control.

LPDISPATCH GetParentBrowser() const;

Return Value

A pointer to the IDispatch interface of the object that is the parent of the WebBrowser control.

Remarks

Applies to Internet Explorer and WebBrowser.

CHtmlView::GetProperty

Call this member function to get the value of the property currently associated with the control.

BOOL GetProperty(
    LPCTSTR lpszProperty,
    CString& strValue);

COleVariant GetProperty(LPCTSTR lpszProperty);

Parameters

lpszProperty
A pointer to a string containing the property to retrieve.

strValue
A reference to a CString object that receives the current value of the property.

Return Value

In the first version, nonzero if completed successfully; otherwise zero. In the second version, a COleVariant object.

Remarks

Applies to Internet Explorer and WebBrowser.

CHtmlView::GetReadyState

Call this member function to retrieve the ready state of the WebBrowser object.

READYSTATE GetReadyState() const;

Return Value

A READYSTATE value, as described in the Windows SDK.

Remarks

Applies to Internet Explorer and WebBrowser.

CHtmlView::GetRegisterAsBrowser

Call this member function to determine whether the WebBrowser object is registered as a top-level browser for target name resolution.

BOOL GetRegisterAsBrowser() const;

Return Value

Nonzero if the browser is registered as a top-level browser; otherwise zero.

Remarks

Applies to Internet Explorer and WebBrowser.

CHtmlView::GetRegisterAsDropTarget

Call this member function to determine whether the WebBrowser control is registered as a drop target for navigation.

BOOL GetRegisterAsDropTarget() const;

Return Value

Nonzero if the browser is registered as a drop target; otherwise zero.

Remarks

Applies to Internet Explorer and WebBrowser.

CHtmlView::GetSilent

Call this member function to determine whether any dialog boxes can be shown in the WebBrowser control.

BOOL GetSilent() const;

Return Value

Nonzero if dialog boxes can't be displayed from the WebBrowser control; otherwise zero.

Remarks

Applies to Internet Explorer and WebBrowser.

CHtmlView::GetSource

Call this member function to retrieve the HTML source code for the web page.

BOOL GetSource(CString& strRef);

Return Value

Nonzero if successful; otherwise zero.

Parameters

refString
A CString that will hold the source code.

Remarks

This function is equivalent to the "View Source" command in Internet Explorer, except that the source code is returned in a CString.

CHtmlView::GetStatusBar

Call this member function to determine whether the WebBrowser control displays a status bar.

BOOL GetStatusBar() const;

Return Value

Nonzero if the status bar can be displayed; otherwise zero.

Remarks

Applies to Internet Explorer. If you use this call with a WebBrowser control, it will return no error, but it will ignore this call.

CHtmlView::GetTheaterMode

Call this member function to determine whether the web browser is in theater mode.

BOOL GetTheaterMode() const;

Return Value

Nonzero if the web browser is in theater mode; otherwise zero.

Remarks

When the web browser is in theater mode, the browser main window fills the entire screen, a toolbar with a minimal set of navigational tools appears, and the status bar appears in the upper right-hand corner of the screen.

Applies to Internet Explorer and WebBrowser.

CHtmlView::GetToolBar

Call this member function to determine whether the toolbar is visible.

int GetToolBar() const;

Return Value

A value indicating whether the toolbar is visible. Nonzero if toolbar is visible; otherwise zero.

CHtmlView::GetTop

Call this member function to retrieve the screen coordinate of the top edge of the WebBrowser control's main window.

long GetTop() const;

Return Value

Address of a variable that receives the screen coordinate of the main window's top edge.

Remarks

Applies to Internet Explorer and WebBrowser.

CHtmlView::GetTopLevelContainer

Call this member function to determine whether Internet Explorer is the top-level container of the WebBrowser control.

BOOL GetTopLevelContainer() const;

Return Value

Nonzero the container is the top-level container; otherwise zero.

Remarks

Applies to Internet Explorer and WebBrowser.

CHtmlView::GetType

Call this member function to retrieve the type name of the contained active document.

CString GetType() const;

Return Value

A CString object containing the type name of the contained active document.

Remarks

Applies to Internet Explorer and WebBrowser.

CHtmlView::GetVisible

Call this member function to determine if the contained object is visible.

BOOL GetVisible() const;

Return Value

Nonzero if the object is visible; otherwise zero.

Remarks

Applies to Internet Explorer and WebBrowser.

CHtmlView::GetWidth

Retrieves the width of the Internet Explorer main window.

long GetWidth() const;

Return Value

The current width of the window, in pixels.

CHtmlView::GoBack

Navigates backward one item in the history list.

void GoBack();

Remarks

Applies to Internet Explorer and WebBrowser.

CHtmlView::GoForward

Navigates forward one item in the history list.

void GoForward();

CHtmlView::GoHome

Navigates to the current home or start page specified in the Internet Explorer Internet Options dialog box or the Internet Properties dialog box, accessed from the Control Panel.

void GoHome();

Remarks

Applies to Internet Explorer and WebBrowser.

CHtmlView::GoSearch

Navigates to the current search page, as specified in the Internet Explorer Internet Options dialog box or the Internet Properties dialog box, accessed from the Control Panel.

void GoSearch();

Remarks

Applies to Internet Explorer and WebBrowser.

CHtmlView::LoadFromResource

Call this member function to load the specified resource into the WebBrowser control.

BOOL LoadFromResource(LPCTSTR lpszResource);
BOOL LoadFromResource(UINT nRes);

Parameters

lpszResource
A pointer to a string containing the name of the resource to load.

nRes
The ID of the buffer containing the name of the resource to load.

Return Value

Nonzero if successful; otherwise zero.

Remarks

Applies to Internet Explorer and WebBrowser.

Call this member function to navigate to the resource identified by a URL.

void Navigate(
    LPCTSTR URL,
    DWORD dwFlags = 0,
    LPCTSTR lpszTargetFrameName = NULL,
    LPCTSTR lpszHeaders = NULL,
    LPVOID lpvPostData = NULL,
    DWORD dwPostDataLen = 0);

Parameters

URL
A caller-allocated string that contains the URL to navigate to, or the full path of the file to display.

dwFlags
The flags of a variable that specifies whether to add the resource to the history list, whether to read to or write from the cache, and whether to display the resource in a new window. The variable can be a combination of the values defined by the BrowserNavConstants enumeration.

lpszTargetFrameName
A pointer to a string that contains the name of the frame in which to display the resource.

lpszHeaders
A pointer to a value that specifies the HTTP headers to send to the server. These headers are added to the default Internet Explorer headers. The headers can specify such things as the action required of the server, the type of data being passed to the server, or a status code. This parameter is ignored if URL isn't an HTTP URL.

lpvPostData
A pointer to the data to send with the HTTP POST transaction. For example, the POST transaction is used to send data gathered by an HTML form. If this parameter doesn't specify any post data, Navigate issues an HTTP GET transaction. This parameter is ignored if URL isn't an HTTP URL.

dwPostDataLen
Data to send with the HTTP POST transaction. For example, the POST transaction is used to send data gathered by an HTML form. If this parameter doesn't specify any post data, Navigate issues an HTTP GET transaction. This parameter is ignored if URL isn't an HTTP URL.

Remarks

Applies to Internet Explorer and WebBrowser.

Call this member function to navigate to the resource identified by a URL, or to the file identified by a full path.

void Navigate2(
    LPITEMIDLIST pIDL,
    DWORD dwFlags = 0,
    LPCTSTR lpszTargetFrameName = NULL);

void Navigate2(
    LPCTSTR lpszURL,
    DWORD dwFlags = 0,
    LPCTSTR lpszTargetFrameName = NULL,
    LPCTSTR lpszHeaders = NULL,
    LPVOID lpvPostData = NULL,
    DWORD dwPostDataLen = 0);

void Navigate2(
    LPCTSTR lpszURL,
    DWORD dwFlags,
    CByteArray& baPostedData,
    LPCTSTR lpszTargetFrameName = NULL,
    LPCTSTR lpszHeader = NULL);

Parameters

pIDL
A pointer to an ITEMIDLIST structure.

dwFlags
The flags of a variable that specifies whether to add the resource to the history list, whether to read to or write from the cache, and whether to display the resource in a new window. The variable can be a combination of the values defined by the BrowserNavConstants enumeration.

lpszTargetFrameName
A pointer to a string that contains the name of the frame in which to display the resource.

lpszURL
A pointer to a string containing the URL.

lpvPostData
Data to send with the HTTP POST transaction. For example, the POST transaction is used to send data gathered by an HTML form. If this parameter doesn't specify any post data, Navigate2 issues an HTTP GET transaction. This parameter is ignored if URL isn't an HTTP or HTTPS URL.

dwPostDataLen
Length in bytes of the data pointed to by the lpvPostData parameter.

lpszHeaders
A pointer to a value that specifies the HTTP or HTTPS headers to send to the server. These headers are added to the default Internet Explorer headers. The headers can specify such things as the action required of the server, the type of data being passed to the server, or a status code. This parameter is ignored if URL isn't an HTTP or HTTPS URL.

baPostedData
A reference to a CByteArray object.

Remarks

This member function extends the Navigate member function by supporting browsing on special folders, such as Desktop and My Computer, that are represented by the parameter pIDL.

Applies to Internet Explorer and WebBrowser.

Example

void CMyHtmlView::OnGoToMicrosoft()
{
   Navigate2(_T("http://home.microsoft.com"));
}

CHtmlView::OnBeforeNavigate2

This member function is called by the framework to cause an event to fire before a navigation operation occurs in the web browser.

virtual void OnBeforeNavigate2(
    LPCTSTR lpszURL,
    DWORD nFlags,
    LPCTSTR lpszTargetFrameName,
    CByteArray& baPostedData,
    LPCTSTR lpszHeaders,
    BOOL* pbCancel);

Parameters

lpszURL
Pointer to a string containing the URL to navigate to.

nFlags
Reserved for future use.

lpszTargetFrameName
A string that contains the name of the frame in which to display the resource, or NULL if no named frame is targeted for the resource.

baPostedData
A reference to a CByteArray object containing the data to send to the server if the HTTP POST transaction is being used.

lpszHeaders
A pointer to a string containing other HTTP headers to send to the server (HTTP URLs only). The headers can specify such things as the action required of the server, the type of data being passed to the server, or a status code.

pbCancel
A pointer to a cancel flag. An application can set this parameter to nonzero to cancel the navigation operation, or to zero to allow it to continue.

CHtmlView::OnCommandStateChange

This member function is called by the framework to notify an application that the enabled state of a web browser command has changed.

virtual void OnCommandStateChange(
    long nCommand,
    BOOL bEnable);

Parameters

nCommand
Identifier of the command whose enabled state has changed.

bEnable
Enabled state. This parameter is nonzero if the command is enabled, or zero if it's disabled.

CHtmlView::OnDocumentComplete

This member function is called by the framework to notify an application that a document has reached the READYSTATE_COMPLETE state.

virtual void OnDocumentComplete(LPCTSTR lpszURL);

Parameters

lpszURL
A pointer to a string that evaluates to the URL, UNC file name, or a PIDL (a pointer to an item identifier list) that was navigated to.

Remarks

Not every frame will fire this event, but each frame that fires an OnDownloadBegin event will fire a corresponding OnDocumentComplete event.

The URL indicated by lpszURL can be different from the URL that the browser was told to navigate to, because this URL is the canonicalized and qualified URL. For example, if an application specifies a URL of "www.microsoft.com" in a call to Navigate or Navigate2, the URL passed by OnNavigateComplete2 will be "<https://www.microsoft.com/>". Also, if the server has redirected the browser to a different URL, the redirected URL will be reflected here.

CHtmlView::OnDocWindowActivate

Called from the Internet Explorer or MSHTML implementation of IOleInPlaceActiveObject::OnDocWindowActivate, which notifies the active in-place object when the container's document window is activated or deactivated.

virtual HRESULT OnDocWindowActivate(BOOL fActivate);

Parameters

fActivate
Indicates the state of the document window. If this value is nonzero, the window is being activated. If this value is zero, the window is being deactivated.

Return Value

S_OK if successful, or an OLE-defined error code otherwise.

Remarks

Override OnDocWindowActivate to react to the OnDocWindowActivate notification from the Microsoft Web Browser control. See IDocHostUIHandler::OnDocWindowActivate in the Windows SDK for more information.

CHtmlView::OnDownloadBegin

This member function is called by the framework to begin downloading a document.

virtual void OnDownloadBegin();

Remarks

This event is fired shortly after the OnBeforeNavigate2 event, unless the navigation is canceled. Any animation or "busy" indication that the container needs to display should be connected to this event.

CHtmlView::OnDownloadComplete

This member function is called by the framework to indicate that a navigation operation finished, was halted, or failed.

virtual void OnDownloadComplete();

CHtmlView::OnEnableModeless

Called when Internet Explorer or MSHTML displays modal UI.

virtual HRESULT OnEnableModeless(BOOL fEnable);

Parameters

fEnable
Indicates if the host's modeless dialog boxes are enabled or disabled. If this value is nonzero, modeless dialog boxes are enabled. If this value is zero, modeless dialog boxes are disabled.

Return Value

S_OK if successful, or an OLE-defined error code otherwise.

Remarks

Enables or disables modeless dialog boxes when the container creates or destroys a modal dialog box. Override OnEnableModeless to react to the EnableModeless notification from the Microsoft Web Browser control. See IDocHostUIHandler::EnableModeless in the Windows SDK for more information.

CHtmlView::OnFilterDataObject

Called on the host by Internet Explorer or MSHTML to allow the host to replace Internet Explorer or MSHTML's data object.

virtual HRESULT OnFilterDataObject(
    LPDATAOBJECT pDataObject,
    LPDATAOBJECT* ppDataObject);

Parameters

pDataObject
Address of the IDataObject interface supplied by Internet Explorer or MSHTML.

ppDataObject
Address that receives the IDataObject interface pointer supplied by the host. The contents of this parameter should always be initialized to NULL, even if the method fails.

Return Value

S_OK if the data object is replaced, S_FALSE if the data object isn't replaced, or an OLE-defined error code if an error occurs.

Remarks

Override OnFilterDataObject to react to the FilterDataObject notification from the Microsoft Web Browser control. See IDocHostUIHandler::FilterDataObject in the Windows SDK for more information.

CHtmlView::OnFrameWindowActivate

Called from IOleInPlaceActiveObject::OnFrameWindowActivate to notify the object when the container's top-level frame window is activated or deactivated.

virtual HRESULT OnFrameWindowActivate(BOOL fActivate);

Parameters

fActivate
Indicates the state of the container's top-level frame window. If this value is nonzero, the window is being activated. If this value is zero, the window is being deactivated.

Return Value

S_OK if successful, or an OLE-defined error code otherwise.

Remarks

Override OnFrameWindowActivate to react to the OnFrameWindowActivate notification from the Microsoft Web Browser control. See IDocHostUIHandler::OnFrameWindowActivate in the Windows SDK for more information.

CHtmlView::OnFullScreen

This member function is called by the framework when the FullScreen property has changed.

virtual void OnFullScreen(BOOL bFullScreen);

Parameters

bFullScreen
Nonzero if Internet Explorer is in full screen mode; zero otherwise.

CHtmlView::OnGetDropTarget

Called by Internet Explorer or MSHTML when it's being used as a drop target to allow the host to supply an alternative IDropTarget.

virtual HRESULT OnGetDropTarget(
    LPDROPTARGET pDropTarget,
    LPDROPTARGET* ppDropTarget);

Parameters

pDropTarget
IDropTarget Internet Explorer or MSHTML proposes to use.

ppDropTarget
Address of the IDropTarget that receives the IDropTarget interface pointer the host wants to provide.

Return Value

See IDocHostUIHandler::GetDropTarget in the Windows SDK for a list of return codes.

Remarks

Override OnGetDropTarget to react to the GetDropTarget notification from the Microsoft Web Browser control. See IDocHostUIHandler::GetDropTarget in the Windows SDK for more information.

CHtmlView::OnGetExternal

Called by Internet Explorer or MSHTML to obtain the host's IDispatch interface.

virtual HRESULT OnGetExternal(LPDISPATCH* lppDispatch);

Parameters

lppDispatch
A pointer to the address that receives the IDispatch interface pointer of the host application. If the host exposes an Automation interface, it can provide a reference to Internet Explorer or MSHTML through this parameter. The contents of this parameter should always be initialized to NULL, even if the method fails.

Return Value

S_OK if successful, or an OLE-defined error code otherwise.

Remarks

Override OnGetExternal to react to the GetExternal notification from the Microsoft Web Browser control. See IDocHostUIHandler::GetExternal in the Windows SDK for more information.

CHtmlView::OnGetHostInfo

Retrieves the UI capabilities of the Internet Explorer or MSHTML host.

virtual HRESULT OnGetHostInfo(DOCHOSTUIINFO* pInfo);

Parameters

pInfo
Address of a DOCHOSTUIINFO structure that receives the host's UI capabilities.

Return Value

S_OK if successful, or an OLE-defined error code otherwise.

Remarks

Override OnGetHostInfo to react to the GetHostInfo notification from the Microsoft Web Browser control. See IDocHostUIHandler::GetHostInfo in the Windows SDK for more information.

CHtmlView::OnGetOptionKeyPath

Call this member function to get the registry key under which Internet Explorer or MSHTML stores user preferences.

virtual HRESULT OnGetOptionKeyPath(
    LPOLESTR* pchKey,
    DWORD dwReserved);

Parameters

pchKey
Address of an LPOLESTR that receives the registry subkey string where the host stores its default options. This subkey will be under the HKEY_CURRENT_USER key. Allocate this memory using CoTaskMemAlloc. The calling application is responsible for freeing this memory using CoTaskMemFree. This parameter should always be initialized to NULL, even if the method fails.

dwReserved
Reserved for future use. Not currently used.

Return Value

S_OK if successful, or S_FALSE otherwise. If S_FALSE, Internet Explorer or MSHTML will default to its own user options.

Remarks

Override OnGetOptionKeyPath to react to the GetOptionKeyPath notification from the Microsoft Web Browser control. See IDocHostUIHandler::GetOptionKeyPath in the Windows SDK for more information.

CHtmlView::OnHideUI

This member function is called by the framework when Internet Explorer or MSHTML removes its menus and toolbars.

virtual HRESULT OnHideUI();

Return Value

S_OK if successful, or an OLE-defined error code otherwise.

Remarks

Override OnHideUI to react to the HideUI notification from the Microsoft Web Browser control. See IDocHostUIHandler::HideUI in the Windows SDK for more information.

CHtmlView::OnMenuBar

This member function is called by the framework when the MenuBar property has changed.

virtual void OnMenuBar(BOOL bMenuBar);

Parameters

bMenuBar
Nonzero if the Internet Explorer menu bar is visible; zero otherwise.

CHtmlView::OnNavigateComplete2

This member function is called by the framework after navigation to a hyperlink completes (on either a window or frameset element).

virtual void OnNavigateComplete2(LPCTSTR strURL);

Parameters

strURL
A string expression that evaluates to the URL, UNC file name, or PIDL (a pointer to an item identifier list) that was navigated to.

Remarks

The URL parameter can be a PIDL if there's a shell name space entity for which there's no URL representation.

The URL contained in strURL can be different from the URL that the browser was told to navigate to, because this URL is the canonicalized and qualified URL. For example, if an application specifies a URL of "www.microsoft.com" in a call to Navigate or Navigate2, the URL passed by OnNavigateComplete2 will be "<https://www.microsoft.com/>". Also, if the server has redirected the browser to a different URL, the redirected URL will be reflected here.

CHtmlView::OnNavigateError

Called by the framework if navigation to a hyperlink fails.

virtual void OnNavigateError(
    LPCTSTR lpszURL,
    LPCTSTR lpszFrame,
    DWORD dwError,
    BOOL* pbCancel);

Parameters

lpszURL
The URL for which navigation failed.

lpszFrame
The name of the frame in which the resource is to be displayed, or NULL if no named frame was targeted for the resource.

dwError
An error status code, if available. For a list of the possible HRESULT and HTTP status codes, see NavigateError Event Status Codes..

pbCancel
Specifies whether to cancel the navigation to an error page or any further autosearch. If TRUE (the default), continue with navigation to an error page or autosearch; if FALSE, cancel navigation to an error page or autosearch.

Remarks

Override this method to provide custom navigation error handling.

For more information, see DWebBrowserEvents2::NavigateError

CHtmlView::OnNewWindow2

This member function is called by the framework when a new window is to be created for displaying a resource.

virtual void OnNewWindow2(
    LPDISPATCH* ppDisp,
    BOOL* Cancel);

Parameters

ppDisp
A pointer to an interface pointer that, optionally, receives the IDispatch interface pointer of a new WebBrowser or Internet Explorer object.

Cancel
A pointer to a cancel flag. An application can set this parameter to nonzero to cancel the navigation operation, or to zero to allow it to continue.

Remarks

This event precedes the creation of a new window from within the WebBrowser.

CHtmlView::OnProgressChange

This member function is called by the framework to notify an application that the progress of a download operation has been updated.

virtual void OnProgressChange(
    long nProgress,
    long nProgressMax);

Parameters

nProgress
Amount of total progress to show, or -1 when progress is complete.

nProgressMax
Maximum progress value.

Remarks

The container can use the information provided by this event to display the number of bytes downloaded so far or to update a progress indicator.

CHtmlView::OnPropertyChange

This member function is called by the framework to notify an application that PutProperty has changed the value of a property.

virtual void OnPropertyChange(LPCTSTR lpszProperty);

Parameters

lpszProperty
A pointer to a string containing the name of the property.

CHtmlView::OnQuit

This member function is called by the framework to notify an application that the Internet Explorer application is ready to quit.

virtual void OnQuit();

CHtmlView::OnResizeBorder

Called from the Internet Explorer or MSHTML implementation of IOleInPlaceActiveObject::ResizeBorder, which alerts the object that it needs to resize its border space.

virtual HRESULT OnResizeBorder(
    LPCRECT prcBorder,
    LPOLEINPLACEUIWINDOW pUIWindow,
    BOOL fFrameWindow);

Parameters

prcBorder
New outer rectangle for border space.

pUIWindow
A pointer to the interface for the frame or document window object whose border has changed.

fFrameWindow
TRUE if the frame window is calling IOleInPlaceActiveObject::ResizeBorder, otherwise FALSE.

Return Value

S_OK if successful, or an OLE-defined error code otherwise.

Remarks

Override OnResizeBorder to react to the ResizeBorder notification from the Microsoft Web Browser control. See IDocHostUIHandler::ResizeBorder in the Windows SDK for more information.

CHtmlView::OnShowContextMenu

Called from Internet Explorer or MSHTML when it's about to show its context menu.

virtual HRESULT OnShowContextMenu(
    DWORD dwID,
    LPPOINT ppt,
    LPUNKNOWN pcmdtReserved,
    LPDISPATCH pdispReserved);

Parameters

dwID
Identifier of the context menu to be displayed. See IDocHostUIHandler::ShowContextMenu in the Windows SDK for a list of values.

ppt
Screen coordinates for the menu.

pcmdtReserved
IOleCommandTarget interface used to query command status and execute commands on this object.

pdispReserved
IDispatch interface of the object at the screen coordinates. This allows a host to differentiate particular objects to provide more specific context.

Return Value

See IDocHostUIHandler::ShowContextMenu in the Windows SDK for a list of values.

Remarks

Override OnShowContextMenu to react to the ShowContextMenu notification from the Microsoft Web Browser control. See IDocHostUIHandler::ShowContextMenu in the Windows SDK for more information.

CHtmlView::OnShowUI

Called before Internet Explorer or MSHTML displays its menus and toolbars.

virtual HRESULT OnShowUI(
    DWORD dwID,
    LPOLEINPLACEACTIVEOBJECT pActiveObject,
    LPOLECOMMANDTARGET pCommandTarget,
    LPOLEINPLACEFRAME pFrame,
    LPOLEINPLACEUIWINDOW pDoc);

Parameters

dwID
Reserved for future use.

pActiveObject
IOleInPlaceActiveObject interface of the currently active object.

pCommandTarget
IOleCommandTarget interface of the object.

pFrame
IOleInPlaceFrame interface of the object. This is needed for menus and toolbars.

pDoc
IOleInPlaceUIWindow interface for the object. This is needed for toolbars.

Return Value

See IDocHostUIHandler::ShowUI in the Windows SDK for a list of values.

Remarks

Override OnShowUI to react to the ShowUI notification from the Microsoft Web Browser control. See IDocHostUIHandler::ShowUI in the Windows SDK for more information.

CHtmlView::OnStatusBar

This member function is called by the framework when the StatusBar property has changed.

virtual void OnStatusBar(BOOL bStatusBar);

Parameters

bStatusBar
Nonzero if Internet Explorer's status bar is visible or zero otherwise.

CHtmlView::OnStatusTextChange

This member function is called by the framework to notify an application that the text of the status bar associated with the WebBrowser control has changed.

virtual void OnStatusTextChange(LPCTSTR lpszText);

Parameters

lpszText
A string that contains the new status bar text.

CHtmlView::OnTheaterMode

This member function is called by the framework when the TheaterMode property has changed.

virtual void OnTheaterMode(BOOL bTheaterMode);

Parameters

bTheaterMode
Nonzero if Internet Explorer is in theater mode; zero otherwise.

CHtmlView::OnTitleChange

This member function is called by the framework to notify an application if the title of a document in the WebBrowser control becomes available or changes.

virtual void OnTitleChange(LPCTSTR lpszText);

Parameters

lpszText
The new document title.

Remarks

For HTML, the title might change; while HTML is still downloading, the URL of the document is set as the title. After the real title (if there is one) is parsed from the HTML, the title is changed to reflect the actual title.

CHtmlView::OnToolBar

This member function is called by the framework when the ToolBar property has changed.

virtual void OnToolBar(BOOL bToolBar);

Parameters

bToolBar
Nonzero if Internet Explorer's toolbar is visible or zero otherwise.

CHtmlView::OnTranslateAccelerator

Called by Internet Explorer or MSHTML when IOleInPlaceActiveObject::TranslateAccelerator or IOleControlSite::TranslateAccelerator is called to process menu accelerator-key messages from the container's message queue.

virtual HRESULT OnTranslateAccelerator(
    LPMSG lpMsg,
    const GUID* pguidCmdGroup,
    DWORD nCmdID);

Parameters

lpMsg
Points to the message that might need to be translated.

pguidCmdGroup
Command group identifier.

nCmdID
Command identifier.

Return Value

S_OK if successful, or S_FALSE otherwise.

Remarks

Override OnTranslateAccelerator to react to the TranslateAccelerator notification from the Microsoft Web Browser control. See IDocHostUIHandler::TranslateAccelerator in the Windows SDK for more information.

CHtmlView::OnTranslateUrl

Called by Internet Explorer or MSHTML to allow the host an opportunity to modify the URL to be loaded.

virtual HRESULT OnTranslateUrl(
    DWORD dwTranslate,
    OLECHAR* pchURLIn,
    OLECHAR** ppchURLOut);

Parameters

dwTranslate
Reserved for future use.

pchURLIn
Address of a string supplied by Internet Explorer or MSHTML that represents the URL to be translated.

ppchURLOut
Address of a string pointer that receives the address of the translated URL. The host allocates the buffer using the task memory allocator. The contents of this parameter should always be initialized to NULL, even if the URL isn't translated or the method fails.

Return Value

S_OK if the URL was translated, S_FALSE if the URL wasn't translated, or an OLE-defined error code if an error occurred.

Remarks

Override OnTranslateUrl to react to the TranslateUrl notification from the Microsoft Web Browser control. See IDocHostUIHandler::TranslateUrl in the Windows SDK for more information.

CHtmlView::OnUpdateUI

Notifies the host that the command state has changed.

virtual HRESULT OnUpdateUI();

Return Value

S_OK if successful, or an OLE-defined error code otherwise.

Remarks

The host should update the state of toolbar buttons. This method is called regardless of the return value from ShowUI. Override OnUpdateUI to react to the UpdateUI notification from the Microsoft Web Browser control.

CHtmlView::OnVisible

This member function is called by the framework when the window for the WebBrowser should be shown or hidden.

virtual void OnVisible(BOOL bVisible);

Parameters

bVisible
Nonzero if the object is visible or zero otherwise.

Remarks

This allows the object control host window to behave the same way the Internet Explorer window would behave.

CHtmlView::PutProperty

Call this member function to set the property associated with a given object.

void PutProperty(
    LPCTSTR lpszProperty,
    const VARIANT& vtValue);

void PutProperty(
    LPCTSTR lpszPropertyName,
    double dValue);

void PutProperty(
    LPCTSTR lpszPropertyName,
    long lValue);

void PutProperty(
    LPCTSTR lpszPropertyName,
    LPCTSTR lpszValue);

void PutProperty(
    LPCTSTR lpszPropertyName,
    short nValue);

Parameters

lpszProperty
A string containing the property to set.

vtValue
The new value of the property indicated by lpszProperty.

lpszPropertyName
A pointer to a string containing the name of the property to set.

dValue
The new value of the property.

lValue
The new value of the property.

lpszValue
A pointer to a string containing the new value of the property.

nValue
The new value of the property.

Remarks

Applies to Internet Explorer and WebBrowser.

CHtmlView::QueryFormsCommand

Queries for the status of one or more commands generated by user interface events.

HRESULT QueryFormsCommand(
    DWORD dwCommandID,
    BOOL* pbSupported,
    BOOL* pbEnabled,
    BOOL* pbChecked);

Parameters

dwCommandID
The identifier of the command being queried for.

pbSupported
A pointer to a BOOL specifying if the command (identified by dwCommandID) is supported. If TRUE, the command is supported; otherwise FALSE.

pbEnabled
A pointer to a BOOL specifying if the command (identified by dwCommandID) is enabled. If TRUE, the command is supported; otherwise FALSE.

pbChecked
A pointer to a BOOL specifying if the command (identified by dwCommandID) is checked. If TRUE, the command is supported; otherwise FALSE.

Return Value

A standard HRESULT value. For a complete listing of possible values, see IOleCommandTarget::QueryStatus in the Windows SDK.

Remarks

QueryFormsCommand implements the behavior of the IOleCommandTarget::QueryStatus method.

CHtmlView::QueryStatusWB

Call this member function to query a command status.

OLECMDF QueryStatusWB(OLECMDID cmdID) const;

Parameters

cmdID
The OLECMDID value of the command for which the caller needs status information.

Return Value

The address of the OLECMDF value that receives the status of the command.

Remarks

QueryStatusWB implements the behavior of the IOleCommandTarget::QueryStatus method.

Applies to Internet Explorer and WebBrowser.

CHtmlView::Refresh

Reloads the URL or file that the web browser is currently displaying.

void Refresh();

Remarks

Refresh contains no parameters for setting the refresh level.

Applies to Internet Explorer and WebBrowser.

CHtmlView::Refresh2

Reloads the file that Internet Explorer is currently displaying.

void Refresh2(int nLevel);

Parameters

nLevel
The address of the variable specifying the refresh level. The possible variables are defined in RefreshConstants, in the Windows SDK.

Remarks

Unlike Refresh, Refresh2 contains a parameter that specifies the refresh level.

Applies to Internet Explorer and WebBrowser.

CHtmlView::SetAddressBar

Call this member function to show or hide the Internet Explorer object's address bar.

void SetAddressBar(BOOL bNewValue);

Parameters

bNewValue
Nonzero to show address bar; otherwise zero.

Remarks

Applies to Internet Explorer. If you use this call with a WebBrowser control, it will return no error, but it will ignore this call.

CHtmlView::SetFullScreen

Call this member function to set Internet Explorer to either full-screen or normal window mode.

void SetFullScreen(BOOL bNewValue);

Parameters

bNewValue
Nonzero for full-screen mode; otherwise zero.

Remarks

In full-screen mode, the Internet Explorer main window is maximized and the status bar, toolbar, menu bar, and title bar are hidden.

Applies to Internet Explorer. If you use this call with a WebBrowser control, it will return no error, but it will ignore this call.

CHtmlView::SetHeight

Call this member function to set the height of the Internet Explorer main window.

void SetHeight(long nNewValue);

Parameters

nNewValue
The height, in pixels, of the main window.

Remarks

Applies to Internet Explorer and WebBrowser.

CHtmlView::SetLeft

Sets the horizontal position of the Internet Explorer main window.

void SetLeft(long nNewValue);

Parameters

nNewValue
The screen coordinate of the left edge of the main window.

CHtmlView::SetMenuBar

Call this member function to show or hide the Internet Explorer menu bar.

void SetMenuBar(BOOL bNewValue);

Parameters

bNewValue
Nonzero to show menu bar; otherwise zero.

Remarks

Applies to Internet Explorer. If you use this call with a WebBrowser control, it will return no error, but it will ignore this call.

CHtmlView::SetOffline

Call this member function to set a value indicating whether the WebBrowser control is currently operating in offline mode.

void SetOffline(BOOL bNewValue);

Parameters

bNewValue
Nonzero to read from the local cache; otherwise zero.

Remarks

In offline mode, the browser reads HTML pages from the local cache rather than from the source document.

Applies to Internet Explorer and WebBrowser.

CHtmlView::SetRegisterAsBrowser

Call this member function to set a value indicating whether the WebBrowser control is registered as a top-level browser for target name resolution.

void SetRegisterAsBrowser(BOOL bNewValue);

Parameters

bNewValue
Determines whether Internet Explorer is registered as a top-level browser. If nonzero, the web browser is registered as a top-level browser; if zero, it's not a top-level browser. The default value is zero.

Remarks

A top-level browser is the browser set in the registry as the default browser.

Applies to Internet Explorer and WebBrowser.

CHtmlView::SetRegisterAsDropTarget

Call this member function to set a value indicating whether the WebBrowser control is registered as a drop target for navigation.

void SetRegisterAsDropTarget(BOOL bNewValue);

Parameters

bNewValue
Determines if the WebBrowser control is registered as a drop target for navigation. If nonzero, the object is registered as a drop target; if zero, it's not a drop target.

Remarks

Applies to Internet Explorer and WebBrowser.

CHtmlView::SetSilent

Call this member function to set a value indicating whether any dialog boxes can be shown.

void SetSilent(BOOL bNewValue);

Parameters

bNewValue
If nonzero, dialog boxes won't be displayed; if zero, dialog boxes will be displayed. The default value is zero.

Remarks

Applies to Internet Explorer and WebBrowser.

CHtmlView::SetStatusBar

Call this member function to display the status bar.

void SetStatusBar(BOOL bNewValue);

Parameters

bNewValue
Nonzero if the status bar is visible; otherwise zero.

Remarks

Applies to Internet Explorer. If you use this call with a WebBrowser control, it will return no error, but it will ignore this call.

CHtmlView::SetTheaterMode

Call this member function to set a value indicating whether the WebBrowser control is in theater mode.

void SetTheaterMode(BOOL bNewValue);

Parameters

bNewValue
Nonzero to set the WebBrowser control to theater mode; otherwise zero. The default value is zero.

Remarks

When the web browser is in theater mode, the browser main window fills the entire screen, a toolbar with a minimal set of navigational tools appears, and the status bar appears in the upper right-hand corner of the screen.

Applies to Internet Explorer and WebBrowser.

CHtmlView::SetToolBar

Call this member function to show or hide the Internet Explorer toolbar.

void SetToolBar(int nNewValue);

Parameters

nNewValue
Indicates whether to display the toolbar. Nonzero if the toolbar is to be displayed; otherwise zero.

Remarks

Applies to Internet Explorer. If you use this call with a WebBrowser control, it will return no error, but it will ignore this call.

CHtmlView::SetTop

Call this member function to set the distance between the internal top edge of the WebBrowser control and the top edge of its container

void SetTop(long nNewValue);

Parameters

nNewValue
The screen coordinate of the top edge of the main window.

Remarks

Applies to Internet Explorer and WebBrowser.

CHtmlView::SetVisible

Call this member function to set the visibility state of the WebBrowser control.

void SetVisible(BOOL bNewValue);

Parameters

bNewValue
Nonzero if the control is visible; otherwise zero.

Remarks

Applies to Internet Explorer and WebBrowser.

CHtmlView::SetWidth

Sets the width of the Internet Explorer main window.

void SetWidth(long nNewValue);

Parameters

nNewValue
The width, in pixels, of the Internet Explorer main window.

CHtmlView::Stop

Call this member function to cancel any pending navigation or download operation and stop any dynamic page elements, such as background sounds and animations.

void Stop();

Remarks

Applies to Internet Explorer and WebBrowser.

See also

MFC Sample MFCIE
CFormView class
Hierarchy chart
IWebBrowser2