CoInitialize(NULL);
HINSTANCE hInst = ::LoadLibrary( _T("OLEACC.DLL") );
string strTemp;
CComPtr<IHTMLDocument2> spDoc;
LRESULT lRes;
strTemp="";
UINT nMsg = ::RegisterWindowMessage( _T("WM_HTML_GETOBJECT") );
::SendMessageTimeout( hwnd, nMsg, 0L, 0L, SMTO_ABORTIFHUNG, 1000, (DWORD*)&lRes );
LPFNOBJECTFROMLRESULT pfObjectFromLresult = (LPFNOBJECTFROMLRESULT)::GetProcAddress( hInst, _T("ObjectFromLresult") );
if ( pfObjectFromLresult != NULL )
{
HRESULT hr;
hr = (*pfObjectFromLresult)( lRes, IID_IHTMLDocument2, 0, (void**)&spDoc );
if ( SUCCEEDED(hr) )
{
CComPtr<IHTMLElement> pHTMLElement;
hr=spDoc->get_body(&pHTMLElement);
BSTR bstrText;
pHTMLElement->get_innerText(&bstrText);
strTemp=(char *)_bstr_t(bstrText);
///strTemp.c_str();
//strTemp.c_str()= the text we want to get
}
}
::FreeLibrary( hInst );


Newbie wrote:tra tui 10$ di tui convert wa VB6 cho



autopilot wrote:Kye you say that you can read the website and display it in your form... what kind of control are you using to display it? if it is a browser control, you will have to pull the text out of the browser to post into the text of the room. Without seeing how you are trying to do this, it is imposible to say what you need to do to fix it. look into the html innertext. That might be the best way to convert it to text.

Users browsing this forum: No registered users and 0 guests