Red de conocimiento informático - Material del sitio web - Cómo obtener el código fuente HTML de un área seleccionada en IE

Cómo obtener el código fuente HTML de un área seleccionada en IE

/Documento simulado.selection.createRange(). text;

/Obtener texto seleccionado;

HRESULT hr = S_OK;

BSTR bstr;

IHTMLSelectionObject* spHTMLSelectionObject;

CComPtr spDisp;

CComPtr spHTMLTxtRange;

hr = m_ spIHTMLDocument2->get_selection((IHTMLSelectionObject**)(&spHTMLSelectionObject));

hr = spHTMLSelectionObject-> createRange((IDispatch**)&spHTMLTxtRange);

hr = spHTMLSelectionObject-> Release();

hr = spHTMLTxtRange-> get_text (&bstr);

:SysFreeString(bstr);

:SysFreeString(bstr)