[英]how to get cursor position using GetSelection in text service framework windows8 application?
HRESULT hr;
TF_SELECTION tfSelection;
ULONG uFetched;
//Obtain the default selection.
hr = _pContext->GetSelection(ec, TF_DEFAULT_SELECTION, 1, &tfSelection, &uFetched);
UINT ar=(UINT)uFetched;
if(SUCCEEDED(hr) && (uFetched > 0))
{
UINT ar=(UINT)uFetched;
//Work with the selection.
//Release the selection range object.
tfSelection.range->Release();
}
Hi all. 大家好。 I am implementing this code in the DoEditSession method. 我正在DoEditSession方法中实现此代码。 When I try to get the selection, I always get a value of 1 for uFetched
. 当我尝试获得选择时,我总是将uFetched
的值uFetched
1。 But the cursor position is not coming? 但是光标位置没有到吗?
I am developing a text service for windows RT using Tsf interface. 我正在使用Tsf界面为Windows RT开发文本服务。 I have integrated libraries that suggests words based on letters we type in the candidate window. 我已经集成了一些库,这些库根据我们在候选窗口中键入的字母来建议单词。 Now I need to get the letters before and after the Cursor Position in the Document. 现在,我需要获取文档中光标位置之前和之后的字母。 So here I have used GetSelection to retrieve the selected text. 因此,这里我使用GetSelection来检索选定的文本。 The problem is I am not able to retrieve the caret position in the document (notepad). 问题是我无法检索文档(记事本)中的插入符号位置。 Is there any specific way in which i can get the letter/text around the caret/cursor position? 有没有什么具体方法可以使我在插入符号/光标位置周围找到字母/文本?
您可以移动选择范围的开始/结束而无需实际修改选择。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.