VB6: Detect Webbrowser button click

Hi,

I've tried a few non-E-E solutions, but none seem to work for me.

I need to detect mouse click on a button in a WebBrowser OCX HTML page, in order to send the code to one of two Subs.

Does anyone have a bullet proof method to do this?

Thanks.
tvtechAsked:
Who is Participating?
 
Rob_JeffreyIT/ProgrammingCommented:
Take a look at the article on MSDN about handling events within a VB6 application called from source HTML hosted in a WebBrowser control, this looks like what you want to do.

https://msdn.microsoft.com/en-ca/library/aa752045%28v=vs.85%29.aspx
0
 
Rob_JeffreyIT/ProgrammingCommented:
If you are writing an ActiveX control that is then being added to a web page - then the built in OnClick function is where you would place the code.

This, however, seems to be a very basic question, though, so I don't think I am understanding the question correctly.

Perhaps you are writing an ActiveX control that you want to then execute JavaScript code within the same page or something?  Can you expand your question?
0
 
tvtechAuthor Commented:
I'm using a standard Webbrowser OCX on a VB6 form. The Webbrowser displays an intranet web page,  which has four named buttons. I need to know when the OnClick event occurs, when one of the buttons is clicked, so that I tell my code what to do when that specific button is clicked.

The Webbrowser does not have an OnClick event and no, I am not writing an OCX.

Thanks.
0
 
tvtechAuthor Commented:
Rob, thanks very much. Works great!
0
 
tvtechAuthor Commented:
Great answer. Just don't forget to set 'My_Default_Method' as the Default, or it won't show the Button.onClick msgbox. :-)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.