Mimics the functionality of the End key.
Unit to use. It can be one of the following.
Flag that indicates how to change the selection. If Extend is zero (or tomMove), the method collapses the selection to an insertion point. If Extend is 1 (or tomExtend), the method moves the active end and leaves the other end alone. The default value is zero.
Pointer to a variable that receives the count of characters that the insertion point or the active end is moved. This parameter can be null.
The method returns an HRESULT value. If the method succeeds, it returns S_OK. If the method fails, it returns one of the following error codes. For more information about COM error codes, see Error Handling in COM.
Unit is neither tomLine nor tomStory.
Failure for some other reason.
Setting Extend to tomExtend (or nonzero) corresponds to the Shift key being pressed. Setting Unit to tomLine corresponds to the Ctrl key not being pressed. Setting Unit to tomStory to Ctrl being pressed. The pDelta parameters receives the number of characters that the insertion point or active end is moved.
The ITextSelection::HomeKey and ITextSelection::EndKey methods are used to mimic the standard Home/End key behavior.
The tomLine value mimics the Home or End key behavior
without the Ctrl key pressed, while tomStory mimics the behavior
with the Ctrl
key pressed. Similarly, tomMove mimics the Home or End key behavior
without the Shift key pressed, while tomExtend mimics the behavior
with the Shift key pressed. So
EndKey(tomStory) converts the selection into an insertion point at the end of the associated story, while
EndKey(tomStory, tomExtend) moves the active end of the selection to the end of the story and leaves the other end where it was.
HomeKey and EndKey methods are logical methods like the Move* methods, rather than directional methods. Thus, they depend on the language that is involved. For example, in Arabic text,
HomeKey moves to the right end of a line, whereas in English text, it moves to the left. Thus,
HomeKey and EndKey are different than the MoveLeft and MoveRight methods. Also, note that the EndKey method is quite different from the
End property, which is the
cp at the end of the selection.
HomeKey and EndKey also differ from the StartOf and EndOf methods in that they extend from the active end, whereas
StartOf extends from Start and
EndOf extends from End.
Minimum supported client
|Windows 2000 Professional [desktop apps only]|
Minimum supported server
|Windows 2000 Server [desktop apps only]|