2
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. When I try to get the selection, I always get a value of 1 for uFetched. But the cursor position is not coming?

I am developing a text service for windows RT using Tsf interface. 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. 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?

Mike Clark
  • 10,027
  • 3
  • 40
  • 54
Narasimha
  • 3,802
  • 11
  • 55
  • 83

1 Answers1

1

You can shift the start/end of the selection range without actually modifying the selection.

Eric Brown
  • 13,774
  • 7
  • 30
  • 71