Hi,
How can I get Current user selection or current cursor location in HTML document? I am useg MSHTML interfaces in MFC.
Thanks. :)
Hi,
How can I get Current user selection or current cursor location in HTML document? I am useg MSHTML interfaces in MFC.
Thanks. :)
CComPtr<IHTMLSelectionObject> pSelection;
hr = pHTMLDocument->get_selection(&pSelection);
if (FAILED(hr) || pSelection==NULL)
return false;
CComPtr<IDispatch> pDispRange;
hr = pSelection->createRange(&pDispRange);
if (FAILED(hr) || pDispRange==NULL)
return false;
CComPtr<IHTMLTxtRange> pRange;
hr = pDispRange->QueryInterface(IID_IHTMLTxtRange,
reinterpret_cast<void**>(&pRange));
if (FAILED(hr)|| pRange ==NULL)
return false;