IHTMLDocument2::get_selectionIHTMLDocument2::get_selection*
*Contents  *Index  *Topic Contents
*Previous Topic: IHTMLDocument2::get_scripts
*Next Topic: IHTMLDocument2::get_readyState

IHTMLDocument2::get_selection


HRESULT get_selection(
    IHTMLSelectionObject **p
);

Retrieves an interface pointer to an object representing the active selection. The active selection can be an insertion point, or a highlighted block of text or other elements in the document upon which the user or a script can carry out an action.

p
Address of a pointer to an IHTMLSelectionObject interface of the object representing the active selection.

You typically use the selection object as input from the user identifying the portion of the document to act on, or as output to the user showing the results of an action.

The user, a script, or an object can create a selection. The user creates a selection by dragging the mouse over a portion of the document. A script or object creates a selection by calling the select method on a text range or similar object.

To carry out work on a selection, you can create a text range object from the selection by using the createRange method.

A document can have only one selection at a time. The selection has a type that determines whether it is empty or contains a contiguous block of consecutive text and/or elements. Although an empty selection contains nothing, it is useful for marking a position in the document.


Up Top of Page
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.