Posted: Sat Mar 29, 2003 5:13 am
Restored from previous forum. Originally posted by ricardo.
Hi,
I want to get the text on the webgadget, i found this source but dont know how to do it in PureBasic, hope that somebody could help, here is with the explanation:
*I dont need the url because i want to read the actual content, suppouse its a mail writing that is unsing webgadget, then there is no url.
---------------------------------------------------------------------
This interface retrieves information about the document, and examines and modifies the HTML elements and text within the document..
So, to get the pointer to the IHTMLDocument2 interface, we will send a 'WM_HTML_GETOBJECT' window message to the 'Internet Explorer_Server' window and pass the result to the ObjectFromLresult() method. A successful call to the ObjectFromLresult() method gives us a pointer to the IHTMLDocument2 interface. Finally, to get the entire text in our application, we call the body property of IHTMLDocument2, which returns us a pointer to the IHTMLElement interface and calls the innerText property of the IHTMLElement interface, which returns us the entire text contained in the conversation text. If you want to get this in its original HTML form, you can call the innerHTML property of IHTMLElement. This will be clear from the following code snippet.
Best Regards
Ricardo
Dont cry for me Argentina...
Hi,
I want to get the text on the webgadget, i found this source but dont know how to do it in PureBasic, hope that somebody could help, here is with the explanation:
*I dont need the url because i want to read the actual content, suppouse its a mail writing that is unsing webgadget, then there is no url.
---------------------------------------------------------------------
This interface retrieves information about the document, and examines and modifies the HTML elements and text within the document..
So, to get the pointer to the IHTMLDocument2 interface, we will send a 'WM_HTML_GETOBJECT' window message to the 'Internet Explorer_Server' window and pass the result to the ObjectFromLresult() method. A successful call to the ObjectFromLresult() method gives us a pointer to the IHTMLDocument2 interface. Finally, to get the entire text in our application, we call the body property of IHTMLDocument2, which returns us a pointer to the IHTMLElement interface and calls the innerText property of the IHTMLElement interface, which returns us the entire text contained in the conversation text. If you want to get this in its original HTML form, you can call the innerHTML property of IHTMLElement. This will be clear from the following code snippet.
Code: Select all
char wndowclass[CLASS_SIZE];
if (GetClassName(hwnd,wndowclass,CLASS_SIZE)==0)
return TRUE;
string strTemp(wndowclass);
if (strTemp==string("Internet Explorer_Server"))
{
CoInitialize(NULL);
HINSTANCE hInst = ::LoadLibrary( _T("OLEACC.DLL") );
string strTemp;
CComPtr 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 pHTMLElement;
hr=spDoc->get_body(&pHTMLElement);
BSTR bstrText;
pHTMLElement->get_innerText(&bstrText);
strTemp=(char *)_bstr_t(bstrText);
pChatText->SetWindowText(strTemp.c_str());
}
}
::FreeLibrary( hInst );
}
Ricardo
Dont cry for me Argentina...