Google Answers Logo
View Question
 
Q: How can MFC catch the web page event? ( No Answer,   1 Comment )
Question  
Subject: How can MFC catch the web page event?
Category: Computers > Internet
Asked by: hareum-ga
List Price: $5.00
Posted: 26 May 2004 17:37 PDT
Expires: 07 Jun 2004 01:06 PDT
Question ID: 352443
Hello!

I developed the Chatting Application using MFC class.
Within this project, some web pages are displaed and interact with CHtmlView class.
And I sucessfullly, called the javascript function of the web page from MFC class.
I'll show you the code that MFC class call the javascript function.

	IHTMLDocument2* pCtrl=(IHTMLDocument2*)m_oMainDlg.m_pWebCtrl->GetHtmlDocument();
	IHTMLWindow2 *pWindow=(IHTMLWindow2*)NULL;
	pCtrl->get_parentWindow(&pWindow);

	BSTR strLanguage;
	BSTR strSript;
	strLanguage=L"JScript";
	CString strTmp;
	strTmp.Format("LoadMovie(\"%s\");", strURL);
	_bstr_t strBuffer(strTmp);
	strSript=(BSTR)strBuffer;
	VARIANT nResult;
	HRESULT hResult;
	hResult=pWindow->execScript(strSript, strLanguage, &nResult);

But I can know the method, that MFC can catch the event or meesage of the web page.
For example, How MFC class can catch the  mouse evet of the image
object of the web page?
This is very important to me.
Thanks.
Answer  
There is no answer at this time.

Comments  
Subject: Re: How can MFC catch the web page event?
From: jgbot-ga on 02 Jun 2004 06:03 PDT
 
This demo project has what you're looking for...

http://www.thecodeproject.com/samples/dhtmlhook.asp

"This example demonstrates how to access DHTML object model and how to
intercept the DHTML element events. It also demonstrates how to use
connectionpoint with MFC. The demo program first loads up a sample
HTML page which contains two button elements and a listbox element.
Then it accesses button element DHTML object and intercepts its Click,
DoubleClick, MouseMove, MouseOver, MouseDown and MouseUp events. After
the program intercepts an event, it records the event information to
the listbox element on the sample HTML page. The example shows that
MSHTML is very useful for Internet and web programming. I hope this
example would provide some help for any one who wants to use MSHTML
library. (You need to download ie5_lib or later IE library to compile
the demo project.)"

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy