Click event with webbrowser control

  • Thread starter Thread starter Rotsey
  • Start date Start date
R

Rotsey

Hi,

I have a form with a webbrowser control set to fill the form.

I want to capture when the form is clicked.

As the browser control is filling the form the user would click on
the browser conttrol, but it does not have a click event.

How can I trap the click event for a form like this????

rotsey
 
Rotsey,

If the web browser control fills the form, then the form will never be
clicked, because the client area of the form is taken up by the web browser
control.

What you could do is override the WndProc method of the form or
WebBrowser control and then intercept the messages going to the form. You
should be able to find a WM_CLICK message and use that to know when the web
browser control is clicked.

However, make sure you call the base implementation of WndProc, because
I am sure you want the web browser to process the click as well (unless
there is to be no interaction, and it is for display purposes only).
 
Rotsey,
If you are talking about handling the submission of a form in an
HTMLDocument that's hosted in your WebBrowser control on your Windows Form,
then you need to handle the IHTMLDocument events and IHTMLElement collection
that represents the form submission in the control, not the click event on
the windows form. This page should help:

http://support.microsoft.com/kb/313068

Peter
 
WndProc worked, thanks

Peter Bromberg said:
Rotsey,
If you are talking about handling the submission of a form in an
HTMLDocument that's hosted in your WebBrowser control on your Windows
Form,
then you need to handle the IHTMLDocument events and IHTMLElement
collection
that represents the form submission in the control, not the click event on
the windows form. This page should help:

http://support.microsoft.com/kb/313068

Peter
--
Recursion: see Recursion
site: http://www.eggheadcafe.com
unBlog: http://petesbloggerama.blogspot.com
BlogMetaFinder: http://www.blogmetafinder.com
 
Back
Top