CHtmlEditCtrlBase Class

 

For the latest documentation on Visual Studio 2017 RC, see Visual Studio 2017 RC Documentation.

Represents an HTML editing component.

template <class T> class CHtmlEditCtrlBase  

Public Methods

NameDescription
CHtmlEditCtrlBase::AddToGlyphTableAdds an entry to the glyph table, which specifies images to display for specific tags in design mode.
CHtmlEditCtrlBase::BoldToggles the bold state of the selected text.
CHtmlEditCtrlBase::ButtonOverwrites a button control on the current selection.
CHtmlEditCtrlBase::CheckBoxOverwrites a check box control on the current selection.
CHtmlEditCtrlBase::ClearSelectionClears the current selection.
CHtmlEditCtrlBase::CopyCopies the current selection to the clipboard.
CHtmlEditCtrlBase::CutCopies the current selection to the clipboard and then deletes it.
CHtmlEditCtrlBase::DeleteDeletes the current selection.
CHtmlEditCtrlBase::DropDownBoxOverwrites a drop-down selection control on the current selection.
CHtmlEditCtrlBase::EmptyGlyphTableRemoves all entries from the glyph table, which hides all images displayed for tags in design mode.
CHtmlEditCtrlBase::ExecCommandExecutes a command.
CHtmlEditCtrlBase::FontOpens a font dialog box to enable the user to change the text color, font, and font size of the current selection.
CHtmlEditCtrlBase::GetAbsolutePositionReturns whether an element's position property is "absolute."
CHtmlEditCtrlBase::GetBackColorRetrieves the background color of the current selection.
CHtmlEditCtrlBase::GetBlockFormatRetrieves the current block format tag.
CHtmlEditCtrlBase::GetBlockFormatNamesRetrieves the strings corresponding to the available block format tags.
CHtmlEditCtrlBase::GetBookMarkRetrieves the name of a bookmark anchor.
CHtmlEditCtrlBase::GetDocumentRetrieves the document object.
CHtmlEditCtrlBase::GetDocumentHTMLRetrieves the HTML of the current document.
CHtmlEditCtrlBase::GetDocumentTitleRetrieves the document's title.
CHtmlEditCtrlBase::GetEventRetrieves an interface pointer to the event object that contains information relevant to the most recent event.
CHtmlEditCtrlBase::GetEventSrcElementRetrieves the object that fired the event.
CHtmlEditCtrlBase::GetFontFaceRetrieves the font name for the current selection.
CHtmlEditCtrlBase::GetFontSizeRetrieves the font size for the current selection.
CHtmlEditCtrlBase::GetForeColorRetrieves the foreground (text) color of the current selection.
CHtmlEditCtrlBase::GetFrameZoneReturns the security zone of the current page in the web browser.
CHtmlEditCtrlBase::GetIsDirtyIndicates whether the HTML document has changed.
CHtmlEditCtrlBase::GetShowAlignedSiteTagsReturns whether a glyph is displayed for all elements that have a styleFloat property.
CHtmlEditCtrlBase::GetShowAllTagsReturns whether the WebBrowser displays glyphs to show the location of all tags in a document.
CHtmlEditCtrlBase::GetShowAreaTagsRetrieves whether the WebBrowser displays a glyph for area tags.
CHtmlEditCtrlBase::GetShowBRTagsRetrieves whether the WebBrowser displays a glyph for br tags.
CHtmlEditCtrlBase::GetShowCommentTagsRetrieves whether the WebBrowser displays a glyph for comment tags.
CHtmlEditCtrlBase::GetShowMiscTagsRetrieves whether the WebBrowser displays all the tags shown in Microsoft Internet Explorer 4.0.
CHtmlEditCtrlBase::GetShowScriptTagsRetrieves whether the WebBrowser displays a glyph for all the script tags.
CHtmlEditCtrlBase::GetShowStyleTagsRetrieves whether the WebBrowser displays a glyph for all the style tags.
CHtmlEditCtrlBase::GetShowUnknownTagsRetrieves whether the WebBrowser displays a glyph for all unknown tags.
CHtmlEditCtrlBase::HorizontalLineOverwrites a horizontal line on the current selection.
CHtmlEditCtrlBase::HyperLinkInserts a hyperlink on the current selection.
CHtmlEditCtrlBase::IE50PastePerforms a paste operation compatible with Microsoft Internet Explorer 5.
CHtmlEditCtrlBase::IframeOverwrites an inline frame on the current selection.
CHtmlEditCtrlBase::ImageOverwrites an image on the current selection.
CHtmlEditCtrlBase::IndentIncreases the indent of the selected text by one indentation increment.
CHtmlEditCtrlBase::InsFieldSetOverwrites a box on the current selection.
CHtmlEditCtrlBase::InsInputButtonOverwrites a button control on the current selection.
CHtmlEditCtrlBase::InsInputHiddenInserts a hidden control on the current selection.
CHtmlEditCtrlBase::InsInputImageOverwrites an image control on the current selection.
CHtmlEditCtrlBase::InsInputPasswordOverwrites a password control on the current selection.
CHtmlEditCtrlBase::InsInputResetOverwrites a reset control on the current selection.
CHtmlEditCtrlBase::InsInputSubmitOverwrites a submit control on the current selection.
CHtmlEditCtrlBase::InsInputUploadOverwrites a file upload control on the current selection.
CHtmlEditCtrlBase::Is1DElementDetermines if an element is statically positioned.
CHtmlEditCtrlBase::Is2DElementDetermines if an element is absolutely positioned.
CHtmlEditCtrlBase::ItalicToggles the current selection between italic and nonitalic.
CHtmlEditCtrlBase::JustifyCenterCenters the format block in which the current selection is located.
CHtmlEditCtrlBase::JustifyLeftLeft-justifies the format block in which the current selection is located.
CHtmlEditCtrlBase::JustifyRightRight-justifies the format block in which the current selection is located.
CHtmlEditCtrlBase::ListBoxOverwrites a list box selection control on the current selection.
CHtmlEditCtrlBase::MarqueeOverwrites an empty marquee on the current selection.
CHtmlEditCtrlBase::NewDocumentCreates a new document.
CHtmlEditCtrlBase::OrderListToggles the current selection between an ordered list and a normal format block.
CHtmlEditCtrlBase::OutdentDecreases by one increment the indentation of the format block in which the current selection is located.
CHtmlEditCtrlBase::ParagraphOverwrites a line break on the current selection.
CHtmlEditCtrlBase::PasteOverwrites the contents of the clipboard on the current selection.
CHtmlEditCtrlBase::PrintDocumentPrints the current document.
CHtmlEditCtrlBase::PrintPreviewOpens the Print Preview window for the current document using either the default print preview template or a custom template.
CHtmlEditCtrlBase::QueryStatusCall this method to query the status of commands.
CHtmlEditCtrlBase::RadioButtonOverwrites a radio control on the current selection.
CHtmlEditCtrlBase::RefreshDocumentRefreshes the current document.
CHtmlEditCtrlBase::RemoveFormatRemoves the formatting tags from the current selection.
CHtmlEditCtrlBase::SaveAsSaves the current Web page to a file.
CHtmlEditCtrlBase::SelectAllSelects the entire document.
CHtmlEditCtrlBase::Set2DPositionAllows absolutely positioned elements to be moved by dragging.
CHtmlEditCtrlBase::SetAbsolutePositionSets an element's position property to "absolute" or "static."
CHtmlEditCtrlBase::SetAtomicSelectionSet atomic selection mode.
CHtmlEditCtrlBase::SetAutoURLDetectModeTurns automatic URL detection on and off.
CHtmlEditCtrlBase::SetBackColorSets the background color of the current selection.
CHtmlEditCtrlBase::SetBlockFormatSets the current block format tag.
CHtmlEditCtrlBase::SetBookMarkCreates a bookmark anchor for the current selection or insertion point.
CHtmlEditCtrlBase::SetCSSEditingLevelSelects which CSS level (CSS1 or CSS2) the editor will support, if any.
CHtmlEditCtrlBase::SetDefaultComposeSettingsCall this method to set the default compose settings.
CHtmlEditCtrlBase::SetDesignModeSet design mode.
CHtmlEditCtrlBase::SetDisableEditFocusUIDisables the hatched border and handles around an element that has edit focus.
CHtmlEditCtrlBase::SetDocumentHTMLSets the HTML of the current document.
CHtmlEditCtrlBase::SetFontFaceSets the font for the current selection.
CHtmlEditCtrlBase::SetFontSizeSets the font size for the current selection.
CHtmlEditCtrlBase::SetForeColorSets the foreground (text) color of the current selection.
CHtmlEditCtrlBase::SetIE5PasteModeSets the paste operation to be compatible with Microsoft Internet Explorer 5.
CHtmlEditCtrlBase::SetLiveResizeCauses the WebBrowser to update an element's appearance continuously during a resizing or moving operation.
CHtmlEditCtrlBase::SetMultiSelectEnables multiple selection.
CHtmlEditCtrlBase::SetOverrideCursorCommands the WebBrowser never to change the mouse pointer.
CHtmlEditCtrlBase::SetOverwriteModeToggles the text-entry mode between insert and overwrite.
CHtmlEditCtrlBase::SetRespectVisInDesignHides invisible elements in design mode.
CHtmlEditCtrlBase::SetShowAlignedSiteTagsDisplays a glyph for all elements that have a styleFloat property.
CHtmlEditCtrlBase::SetShowAllTagsDisplays glyphs to show the location of all tags in a document.
CHtmlEditCtrlBase::SetShowAreaTagsDisplays a glyph for all the area tags.
CHtmlEditCtrlBase::SetShowBRTagsDisplays a glyph for all the br tags.
CHtmlEditCtrlBase::SetShowCommentTagsDisplays a glyph for all the comment tags.
CHtmlEditCtrlBase::SetShowMiscTagsDisplays all the tags shown in Microsoft Internet Explorer 4.0.
CHtmlEditCtrlBase::SetShowScriptTagsDisplays a glyph for all the script tags.
CHtmlEditCtrlBase::SetShowStyleTagsDisplays a glyph for all the style tags.
CHtmlEditCtrlBase::SetShowUnknownTagsDisplays a glyph for all the unknown tags.
CHtmlEditCtrlBase::TextAreaOverwrites a multiline text input control on the current selection.
CHtmlEditCtrlBase::TextBoxOverwrites a text control on the current selection.
CHtmlEditCtrlBase::UnBookmarkRemoves any bookmark from the current selection.
CHtmlEditCtrlBase::UnderlineToggles the current selection between underlined and not underlined.
CHtmlEditCtrlBase::UnlinkRemoves any hyperlink from the current selection.
CHtmlEditCtrlBase::UnorderListToggles the current selection between an ordered list and a normal format block.

Parameters

T
The name of the derived class.

CHtmlEditCtrlBase provides member functions for the WebBrowser's HTML editing commands, such as Bold. (Alternately, you can call ExecCommand to execute the IDM_BOLD command.)

CHtmlEditCtrlBase is not intended to stand on its own. It is designed to be a base class for derived classes that expose the HTML editing functionality of the WebBrowser (see CHtmlEditCtrl and CHtmlEditView).

CHtmlEditCtrlBase

Header: afxhtml.h

Adds an entry to the glyph table, which specifies images to display for specific tags in design mode.

HRESULT AddToGlyphTable(
    LPCTSTR szTag,  
    LPCTSTR szImgUrl,  
    unsigned short nTagType,  
    unsigned short nAlignment,  
    unsigned short nPosInfo,  
    unsigned short nDirection,  
    unsigned int nImgWidth,  
    unsigned int nImgHeight) const;

 

Parameters

szTag
The tag name (for example, "P" or "table").

szImgUrl
The image URL.

nTagType
Tag type: 0 means the image is for the opening tag only. 1 means the image is for the closing tag only. 2 means the image is for both the opening and closing tags. Single tags such as br and comment must be added with the tag type set to 0.

nAlignment
Alignment (rectangular elements only): This parameter indicates that the image is for an element with an alignment attribute. Left = 0, center = 1, right = 2, and undefined = 3. Left, right, or center attributes must be explicitly set on the element.

nPosInfo
Positioning information. Determines what cascading style sheets (CSS) positioning value the glyph applies to, where static positioning = 0, absolute positioning = 1, relative positioning = 2, and all = 3. This field enables you to specify one glyph for a tag when it is not positioned and another glyph to show an anchor point when the tag is positioned.

nDirection
The direction. This parameter specifies the image for a tag based on the reading order of the current language. 0 specifies left to right, 1 specifies right to left, 2 specifies top to bottom, 3 specifies bottom to top, and 4 specifies all. You normally set this field to 4.

nImgWidth
The image width in pixels.

nImgHeight
The image height in pixels.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

For more information on the parameters, see "Glyph Table String Format" in Using Editing Glyphs.

This method sends the IDM_ADDTOGLYPHTABLE command ID to the WebBrowser control.

Toggles the bold state of the selected text.

HRESULT Bold() const;

 

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM_BOLD command ID to the WebBrowser control.

Overwrites a button control on the current selection.

HRESULT Button(LPCTSTR szId = NULL) const;

 

Parameters

szId
The ID of the button control.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM_BUTTON command ID to the WebBrowser control.

Overwrites a check box control on the current selection.

HRESULT CheckBox(LPCTSTR szId = NULL) const;

 

Parameters

szId
The ID of the check box control.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM_CHECKBOX command ID to the WebBrowser control.

Clears the current selection.

HRESULT ClearSelection() const;

 

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM_CLEARSELECTION command ID to the WebBrowser control.

Copies the current selection to the clipboard.

HRESULT Copy() const;

 

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM_COPY command ID to the WebBrowser control.

Copies the current selection to the clipboard and then deletes it.

HRESULT Cut() const;

 

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM_CUT command ID to the WebBrowser control.

Deletes the current selection.

HRESULT Delete() const;

 

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM_DELETE command ID to the WebBrowser control.

Overwrites a drop-down selection control on the current selection.

HRESULT DropDownBox(LPCTSTR szId = NULL) const;

 

Parameters

szId
The ID of the drop-down selection control.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM_DROPDOWNBOX command ID to the WebBrowser control.

Removes all entries from the glyph table, which hides all images displayed for tags in design mode.

HRESULT EmptyGlyphTable() const;

 

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM_EMPTYGLYPHTABLE command ID to the WebBrowser control.

Executes a command.

HRESULT ExecCommand(
    long cmdID,  
    long cmdExecOpt,  
    VARIANT* pInVar = NULL,  
    VARIANT* pOutVar = NULL) const;

 
 
HRESULT ExecCommand(
    const GUID* pGuid,  
    long cmdID,  
    long cmdExecOpt,  
    VARIANT* pInVar = NULL,  
    VARIANT* pOutVar = NULL) const;

 

Parameters

cmdID
The command ID to be executed. For a list, see MSHTML Command Identifiers.

cmdExecOpt
Values taken from the OLECMDEXECOPT enumeration, which describe how the object should execute the command.

pInVar
The input arguments.

pOutVar
The command output.

pGuid
The GUID of the command group.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method provides the functionality of IOleCommandTarget::Exec.

Opens a font dialog box to enable the user to change the text color, font, and font size of the current selection.

HRESULT Font() const;

 

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM_FONT command ID to the WebBrowser control.

Returns whether an element's position property is "absolute."

HRESULT GetAbsolutePosition(bool& bCurValue) const;

 

Parameters

bCurValue
True if the element's position property is set to "absolute."

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

For more information, see IDM_ABSOLUTE_POSITION Command ID.

Retrieves the background color of the current selection.

HRESULT GetBackColor(int& nColor) const;

 

Parameters

nColor
The background color.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM_BACKCOLOR Command ID to the WebBrowser control.

Retrieves the current block format tag.

HRESULT GetBlockFormat(CString& strFormat) const;

 

Parameters

strFormat
The current block format tag.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM_BLOCKFMT command ID to the WebBrowser control.

Retrieves the strings corresponding to the available block format tags.

HRESULT GetBlockFormatNames(CStringArray& sa) const;

 

Parameters

sa
The available block format tags, as an array of strings.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM_GETBLOCKFMTS command ID to the WebBrowser control.

Retrieves the name of a bookmark anchor.

HRESULT GetBookMark(CString& strAnchor) const;

 

Parameters

strAnchor
The name of a bookmark anchor.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

For more information, see IDM_BOOKMARK Command ID.

Retrieves the document object.

HRESULT GetDocument(IHTMLDocument2** ppDoc) const;

 

Parameters

ppDoc
The document object.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Retrieves the HTML of the current document.

HRESULT GetDocumentHTML(CString& szHTML) const;

 

Parameters

szHTML
The HTML.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Retrieves the document's title.

HRESULT GetDocumentTitle(CString& szTitle) const;

 

Parameters

szTitle
The document's title.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Retrieves an interface pointer to the event object that contains information relevant to the most recent event.

HRESULT GetEvent(IHTMLEventObj** ppEventObj) const;

 

Parameters

ppEventObj
The event object.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Retrieves the object that fired the event.

HRESULT GetEventSrcElement(IHTMLElement** ppSrcElement) const;

 

Parameters

ppSrcElement
The element that fired the event.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Retrieves the font name for the current selection.

HRESULT GetFontFace(CString& strFace) const;

 

Parameters

strFace
The font name.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

If the current selection uses more than one font, strFace will be an empty string.

This method sends the IDM_FONTNAME command ID to the WebBrowser control.

Retrieves the font size for the current selection.

HRESULT GetFontSize(short& nSize) const;

 

Parameters

nSize
The font size.

Return Value

Returns the HTML font size (1-7). Returns 0 if the selection contains multiple font sizes.

Remarks

This method sends the IDM_FONTSIZE command ID to the WebBrowser control.

Retrieves the foreground (text) color of the current selection.

HRESULT GetForeColor(int& nColor);

Parameters

nColor
The foreground color.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM_FORECOLOR Command ID to the WebBrowser control.

Returns the security zone of the current page in the web browser.

HRESULT GetFrameZone(short& nZone) const;

 

Parameters

nZone
The security zone.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM_GETFRAMEZONE command ID to the WebBrowser control.

Indicates whether the HTML document has changed.

HRESULT GetIsDirty() const;

 

Remarks

Indicates whether the document has changed. GetIsDirty returns an HRESULT from IPersistStorage::IsDirty.

Returns whether a glyph is displayed for all elements that have a styleFloat property.

HRESULT GetShowAlignedSiteTags(bool& bCurValue) const;

 

Parameters

bCurValue
True if a glyph is displayed for all elements that have a styleFloat property; false if no glyph is displayed.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

For more information, see IDM_SHOWALIGNEDSITETAGS Command ID.

Returns whether the WebBrowser displays glyphs to show the location of all tags in a document.

HRESULT GetShowAllTags(bool& bCurValue) const;

 

Parameters

bCurValue
True if the WebBrowser displays glyphs to show the location of all tags in a document; false if it does not.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

For more information, see IDM_SHOWALLTAGS Command ID.

Retrieves whether the WebBrowser displays a glyph for area tags.

HRESULT GetShowAreaTags(bool& bCurValue) const;

 

Parameters

bCurValue
True if the WebBrowser displays a glyph for area tags, false if it does not.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

For more information, see IDM_SHOWAREATAGS Command ID.

Retrieves whether the WebBrowser displays a glyph for br tags.

HRESULT GetShowBRTags(bool& bCurValue) const;

 

Parameters

bCurValue
True if the WebBrowser displays a glyph for br tags, false if it doesn't.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

For more information, see IDM_SHOWWBRTAGS Command ID.

Retrieves whether the WebBrowser displays a glyph for comment tags.

HRESULT GetShowCommentTags(bool& bCurValue) const;

 

Parameters

bCurValue
True if the WebBrowser displays a glyph for comment tags, false if it doesn't.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

For more information, see IDM_SHOWCOMMENTTAGS Command ID.

Retrieves whether the WebBrowser displays all the tags shown in Microsoft Internet Explorer 4.0.

HRESULT GetShowMiscTags(bool& bCurValue) const;

 

Parameters

bCurValue
True if the WebBrowser displays all the tags shown in Microsoft Internet Explorer 4.0, false if it does not.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

For more information, see IDM_SHOWMISCTAGS Command ID.

Retrieves whether the WebBrowser displays a glyph for all the script tags.

HRESULT GetShowScriptTags(bool& bCurValue) const;

 

Parameters

bCurValue
True if the WebBrowser displays a glyph for all the script tags, false if it does not.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

For more information, see IDM_SHOWSCRIPTTAGS Command ID.

Retrieves whether the WebBrowser displays a glyph for all the style tags.

HRESULT GetShowStyleTags(bool& bCurValue) const;

 

Parameters

bCurValue
True if the WebBrowser displays a glyph for all the style tags, false if it does not

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

For more information, see IDM_SHOWSTYLETAGS Command ID.

Retrieves whether the WebBrowser displays a glyph for all unknown tags.

HRESULT GetShowUnknownTags(bool& bCurValue) const;

 

Parameters

bCurValue
True if the WebBrowser displays a glyph for all unknown tags, false if it does not.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

For more information, see IDM_SHOWUNKNOWNTAGS Command ID.

Overwrites a horizontal line on the current selection.

HRESULT HorizontalLine(LPCTSTR szId = NULL) const;

 

Parameters

szID
The ID for the horizontal line.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM_HORIZONTALLINE command ID to the WebBrowser control.

Inserts a hyperlink on the current selection.

HRESULT HyperLink(LPCTSTR szUrl = NULL) const;

 

Parameters

szUrl
The hyperlink URL.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM_HYPERLINK command ID to the WebBrowser control.

Performs a paste operation that's compatible with Internet Explorer 5.

HRESULT IE50Paste(LPCTSTR szData) const;

 

Parameters

szData
The string to paste.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM_IE50_PASTE command ID to the WebBrowser control.

Overwrites an inline frame on the current selection.

HRESULT Iframe(LPCTSTR szId = NULL) const;

 

Parameters

szId
The ID for the inline frame.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM_IFRAME command ID to the WebBrowser control.

Overwrites an image on the current selection.

HRESULT Image(LPCTSTR szUrl = NULL) const;

 

Parameters

szUrl
The path and file name of the image to be inserted.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM_IMAGE command ID to the WebBrowser control.

Increases the indent of the selected text by one indentation increment.

HRESULT Indent() const;

 

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM_INDENT command ID to the WebBrowser control.

Overwrites a box on the current selection.

HRESULT InsFieldSet(LPCTSTR szId = NULL) const;

 

Parameters

szId
The ID for the box.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM_INSFIELDSET command ID to the WebBrowser control.

Overwrites a button control on the current selection.

HRESULT InsInputButton(LPCTSTR szId = NULL) const;

 

Parameters

szId
The ID for the button control.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM_INSINPUTBUTTON command ID to the WebBrowser control.

Inserts a hidden control on the current selection.

HRESULT InsInputHidden(LPCTSTR szId = NULL) const;

 

Parameters

szId
The ID for the hidden control.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM_INSINPUTHIDDEN command ID to the WebBrowser control.

Overwrites an image control on the current selection.

HRESULT InsInputImage(LPCTSTR szId = NULL) const;

 

Parameters

szId
The ID for the image control.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM_INSINPUTIMAGE command ID to the WebBrowser control.

Overwrites a password control on the current selection.

HRESULT InsInputPassword(LPCTSTR szId = NULL) const;

 

Parameters

szId
The ID for the password control.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM_INSINPUTPASSWORD command ID to the WebBrowser control.

Overwrites a reset control on the current selection.

HRESULT InsInputReset(LPCTSTR szId = NULL) const;

 

Parameters

szId
The ID for the reset control.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM_INSINPUTRESET command ID to the WebBrowser control.

Overwrites a submit control on the current selection.

HRESULT InsInputSubmit(LPCTSTR szId = NULL) const;

 

Parameters

szId
The ID for the submit control.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM_INSINPUTSUBMIT command ID to the WebBrowser control.

Overwrites a file upload control on the current selection.

HRESULT InsInputUpload(LPCTSTR szId = NULL) const;

 

Parameters

szId
The ID for the file upload control.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM_INSINPUTUPLOAD command ID to the WebBrowser control.

Determines if an element is statically positioned.

HRESULT Is1DElement(bool& bValue) const;

 

Parameters

bValue
True if the element is statically positioned, false otherwise.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM_1D_ELEMENT command ID to the WebBrowser control.

Determines if an element is absolutely positioned.

HRESULT Is2DElement(bool& bValue) const;

 

Parameters

bValue
True if the element is absolutely positioned, false otherwise.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM_2D_ELEMENT command ID to the WebBrowser control.

Toggles the current selection between italic and nonitalic.

HRESULT Italic() const;

 

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM_ITALIC command ID to the WebBrowser control.

Centers the format block in which the current selection is located.

HRESULT JustifyCenter() const;

 

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM_JUSTIFYCENTER command ID to the WebBrowser control.

Left-justifies the format block in which the current selection is located.

HRESULT JustifyLeft() const;

 

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM_JUSTIFYLEFT command ID to the WebBrowser control.

Right-justifies the format block in which the current selection is located.

HRESULT JustifyRight() const;

 

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM_JUSTIFYRIGHT command ID to the WebBrowser control.

Overwrites a list box selection control on the current selection.

HRESULT ListBox(LPCTSTR szId = NULL) const;

 

Parameters

szId
The ID for the list box control.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM_LISTBOX command ID to the WebBrowser control.

Overwrites an empty marquee on the current selection.

HRESULT Marquee(LPCTSTR szId = NULL) const;

 

Parameters

szId
The ID for the marquee.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM_MARQUEE command ID to the WebBrowser control.

Creates a new document.

HRESULT NewDocument() const;

 

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Toggles the current selection between an ordered list and a normal format block.

HRESULT OrderList(LPCTSTR szId = NULL) const;

 

Parameters

szId
The ID for the ordered list.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM_ORDERLIST command ID to the WebBrowser control.

Decreases by one increment the indentation of the format block in which the current selection is located.

HRESULT Outdent() const;

 

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM_OUTDENT command ID to the WebBrowser control.

Overwrites a line break on the current selection.

HRESULT Paragraph(LPCTSTR szId = NULL) const;

 

Parameters

szId
The ID for the paragraph.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM_PARAGRAPH command ID to the WebBrowser control.

Overwrites the contents of the clipboard on the current selection.

HRESULT Paste() const;

 

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM_PASTE command ID to the WebBrowser control.

Prints the current document.

HRESULT PrintDocument() const;

 
 
HRESULT PrintDocument(LPCTSTR szPrintTemplate) const;

 
 
HRESULT PrintDocument(bool bShowPrintDialog) const;

 

Parameters

szPrintTemplate
Path to a print template; if none is specified, the default print template is used.

bShowPrintDialog
If true, shows the Print dialog.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM_PRINT command ID to the WebBrowser control.

Opens the Print Preview window for the current document using either the default print preview template or a custom template.

HRESULT PrintPreview() const;

 
 
HRESULT PrintPreview(LPCTSTR szPrintTemplate) const;

 

Parameters

szPrintTemplate
Path to a print template.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM_PRINTPREVIEW command ID to the WebBrowser control.

Call this method to query the status of commands.

long QueryStatus(long cmdID) const;

 

Parameters

cmdID
The command ID. Command identifiers are taken from the CGID_MSHTMLcommand group. These commands are defined in Mshtmcid.h. You can also find the list online at MSHTML Command Identifiers.

Return Value

Returns an OLECMDF indicating the status for cmdID, or 0 on failure.

Overwrites a radio control on the current selection.

HRESULT RadioButton(LPCTSTR szId = NULL) const;

 

Parameters

szId
The ID of the radio button.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM_RADIOBUTTON command ID to the WebBrowser control.

Refreshes the current document.

HRESULT RefreshDocument() const;

 

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM_REFRESH Command ID to the WebBrowser control.

Removes the formatting tags from the current selection.

HRESULT RemoveFormat() const;

 

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM_REMOVEFORMAT command ID to the WebBrowser control.

Saves the current Web page to a file.

HRESULT SaveAs(LPCTSTR szPath = NULL) const;

 

Parameters

szPath
The path and file name to which to save the Web page.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM_SAVEAS command ID to the WebBrowser control.

Selects the entire document.

HRESULT SelectAll() const;

 

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM_SELECTALL command ID to the WebBrowser control.

Allows absolutely positioned elements to be moved by dragging.

HRESULT Set2DPosition(bool bNewValue) const;

 

Parameters

bNewValue
If true, absolutely positioned elements can be moved by dragging.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM_2D_POSITION command ID to the WebBrowser control.

Sets an element's position property to "absolute" or "static."

HRESULT SetAbsolutePosition(bool bNewValue) const;

 

Parameters

bNewValue
If true, the element's position property is "absolute"; if false, it is "static."

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM_ABSOLUTE_POSITION command ID to the WebBrowser control.

Set atomic selection mode.

HRESULT SetAtomicSelection(bool bNewValue) const;

 

Parameters

bNewValue
If true, any element that has an ATOMICSELECTION attribute set to TRUE will be selectable only as a unit.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM_ATOMICSELECTION command ID to the WebBrowser control.

Turns automatic URL detection on and off.

HRESULT SetAutoURLDetectMode(bool bNewValue) const;

 

Parameters

bNewValue
If true, automatic URL detection is enabled.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM_AUTOURLDETECT_MODE command ID to the WebBrowser control.

Sets the background color of the current selection.

HRESULT SetBackColor(int nColor) const;

 
 
HRESULT SetBackColor(LPCTSTR szColor) const;

 

Parameters

nColor
The color. See pvaIn in IDM_BACKCOLOR Command ID.

szColor
The color. See pvaIn in IDM_BACKCOLOR Command ID.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM_BACKCOLOR_ command ID to the WebBrowser control.

Sets the current block format tag.

HRESULT SetBlockFormat(LPCTSTR szFormat) const;

 

Parameters

szFormat
The format tag.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM_BLOCKFMT_command ID to the WebBrowser control.

Creates a bookmark anchor for the current selection or insertion point.

HRESULT SetBookMark(LPCTSTR szAnchorName) const;

 

Parameters

szAnchorName
The anchor name.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM_BOOKMARK command ID to the WebBrowser control.

Selects which CSS level (CSS1 or CSS2) the editor will support, if any.

HRESULT SetCSSEditingLevel(short nLevel) const;

 

Parameters

nLevel
The CSS level. Pass 0 if you do not want CSS support.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM_CSSEDITING_LEVEL command ID to the WebBrowser control.

Call this method to set the default compose settings.

HRESULT SetDefaultComposeSettings(
    LPCSTR szFontName = NULL,  
    unsigned short nFontSize = 3,  
    COLORREF crFontColor = 0xFF000000,  
    COLORREF crFontBgColor = 0xFF000000,  
    bool bBold = false,  
    bool bItalic = false,  
    bool bUnderline = false) const;

 

Parameters

szFontName
The font name.

nFontSize
The font size.

crFontColor
The font color.

crFontBgColor
The font background color.

bBold
Pass true for bold text.

bItalic
Pass true for italic text.

bUnderline
Pass true for underlined text.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM_COMPOSESETTINGS command ID to the WebBrowser control.

Set design mode.

BOOL SetDesignMode(BOOL bMode) const;

 

Parameters

bMode
If true, turns design mode on.

Return Value

Returns TRUE on success, FALSE on failure.

Disables the hatched border and handles around an element that has edit focus.

HRESULT SetDisableEditFocusUI(bool bNewValue) const;

 

Parameters

bNewValue
If true, disables the hatched border and handles around a site selectable element when the element has "edit focus" in design mode; that is, when the text or contents of the element can be edited.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM_DISABLE_EDITFOCUS_UI command ID to the WebBrowser control.

Sets the HTML of the current document.

HRESULT SetDocumentHTML(LPCTSTR szHTML) const;

 

Parameters

szHTML
The HTML.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Sets the font for the current selection.

HRESULT SetFontFace(LPCTSTR szFace) const;

 

Parameters

szFace
The font name.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM FONTNAME Command ID to the WebBrowser control.

Sets the font size for the current selection.

HRESULT SetFontSize(unsigned short size) const;

 

Parameters

size
The HTML font size (1-7). A value of 0 sets the font size to 1.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM FONTSIZE command ID to the WebBrowser control.

Sets the foreground (text) color of the current selection.

HRESULT SetForeColor(LPCTSTR szColor) const;

 
 
HRESULT SetForeColor(int nColor) const;

 

Parameters

szColor
The color.

nColor
The color.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM FORECOLOR command ID to the WebBrowser control.

Sets the paste operation to be compatible with Microsoft Internet Explorer 5.

HRESULT SetIE5PasteMode(bool bNewValue) const;

 

Parameters

bNewValue
If true, all paste operations are compatible with Internet Explorer 5; if false, paste operations are compatible with Internet Explorer 5.5.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM IE50_PASTE_MODE command ID to the WebBrowser control.

Causes the WebBrowser to update an element's appearance continuously during a resizing or moving operation, rather than updating only at the completion of the move or resize.

HRESULT SetLiveResize(bool bNewValue) const;

 

Parameters

bNewValue
If true, causes the WebBrowser to update an element's appearance continuously during a resizing or moving operation; if false, it updates only at the completion of the move or resize.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM LIVERESIZE command ID to the WebBrowser control.

Enables multiple selection.

HRESULT SetMultiSelect(bool bNewValue) const;

 

Parameters

bNewValue
If true, allows for the selection of more than one site-selectable element at a time when the user holds down the SHIFT or CTRL keys.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM MULTIPLESELECTION command ID to the WebBrowser control.

Commands the WebBrowser never to change the mouse pointer.

HRESULT SetOverrideCursor(bool bNewValue) const;

 

Parameters

bNewValue
If true, the WebBrowser will not change the mouse pointer.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM OVERRIDE_CURSOR command ID to the WebBrowser control.

Toggles the text-entry mode between insert and overwrite.

HRESULT SetOverwriteMode(bool bMode) const;

 

Parameters

bMode
If true, text-entry mode is overwrite; if false, text-entry mode is insert.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM OVERWRITE command ID to the WebBrowser control.

Hides invisible elements in design mode.

HRESULT SetRespectVisInDesign(bool bNewValue) const;

 

Parameters

bNewValue
If true, any elements that have a visibility set to "hidden" or display property set to "none" will not be shown in both design mode and browse mode; if false, those elements will be displayed only in browse mode.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM RESPECTVISIBILITY_INDESIGN command ID to the WebBrowser control.

Displays a glyph for all elements that have a styleFloat property.

HRESULT SetShowAlignedSiteTags(bool bNewValue) const;

 

Parameters

bNewValue
If true, displays a glyph for all elements that have a styleFloat property.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM SHOWALIGNEDSITETAGS command ID to the WebBrowser control.

Displays glyphs to show the location of all tags in a document.

HRESULT SetShowAllTags(bool bNewValue) const;

 

Parameters

bNewValue
If true, displays glyphs to show the location of all tags in a document.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM SHOWALLTAGS command ID to the WebBrowser control.

Displays a glyph for all the area tags.

HRESULT SetShowAreaTags(bool bNewValue) const;

 

Parameters

bNewValue
If true, displays a glyph for all the area tags.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM SHOWAREATAGS command ID to the WebBrowser control.

Displays a glyph for all the br tags.

HRESULT SetShowBRTags(bool bNewValue) const;

 

Parameters

bNewValue
If true, displays a glyph for all the br tags.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM SHOWWBRTAGS command ID to the WebBrowser control.

Displays a glyph for all the comment tags.

HRESULT SetShowCommentTags(bool bNewValue) const;

 

Parameters

bNewValue
If true, displays a glyph for all the comment tags.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM SHOWCOMMENTTAGS command ID to the WebBrowser control.

Displays all the tags shown in Microsoft Internet Explorer 4.0.

HRESULT SetShowMiscTags(bool bNewValue) const;

 

Parameters

bNewValue
If true, displays all the tags shown in Microsoft Internet Explorer 4.0.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM SHOWMISCTAGS command ID to the WebBrowser control.

Displays a glyph for all the script tags.

HRESULT SetShowScriptTags(bool bNewValue) const;

 

Parameters

bNewValue
If true, displays a glyph for all the script tags.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM SHOWSCRIPTTAGS command ID to the WebBrowser control.

Displays a glyph for all the style tags.

HRESULT SetShowStyleTags(bool bNewValue) const;

 

Parameters

bNewValue
If true, displays a glyph for all the style tags.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM SHOWSTYLETAGS command ID to the WebBrowser control.

Displays a glyph for all the unknown tags.

HRESULT SetShowUnknownTags(bool bNewValue) const;

 

Parameters

bNewValue
If true, displays a glyph for all the unknown tags.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM SHOWUNKNOWNTAGS command ID to the WebBrowser control.

Overwrites a multiline text input control on the current selection.

HRESULT TextArea(LPCTSTR szId = NULL) const;

 

Parameters

szId
The ID of the multiline text input control.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM TEXTAREA command ID to the WebBrowser control.

Overwrites a text control on the current selection.

HRESULT TextBox(LPCTSTR szId = NULL) const;

 

Parameters

szId
The ID of the text control.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM TEXTBOX command ID to the WebBrowser control.

Removes any bookmark from the current selection.

HRESULT UnBookmark() const;

 

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM UNBOOKMARK command ID to the WebBrowser control.

Toggles the current selection between underlined and not underlined.

HRESULT Underline() const;

 

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM UNDERLINE command ID to the WebBrowser control.

Removes any hyperlink from the current selection.

HRESULT Unlink() const;

 

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM UNLINK command ID to the WebBrowser control.

Toggles the current selection between an ordered list and a normal format block.

HRESULT UnorderList(LPCTSTR szId = NULL) const;

 

Parameters

szId
The ID of the unordered list.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method sends the IDM UNORDERLIST command ID to the WebBrowser control.

Hierarchy Chart
HTMLEdit Sample

Show: