?
Solved

How to add event handler to IDocument2.onclick  using C#?

Posted on 2003-11-06
3
Medium Priority
?
571 Views
Last Modified: 2008-03-04
How to add event handler to IDocument2.onclick  using C# if I have and oject of mshtml.IDocument2 ?
0
Comment
Question by:AlexanderShkabarnya
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 6

Accepted Solution

by:
purpleblob earned 760 total points
ID: 9695614
Assuming you've got mshtml reference etc.

((mshtml.HTMLDocumentEvents2_Event)html2).onclick += new mshtml.HTMLDocumentEvents2_onclickEventHandler(this.HTML_onclick);

And

private bool HTML_onclick(mshtml.IHTMLEventObj e)
{
   MessageBox.Show("OnClick");
   return true;
}

Note: I've prefixed mshtml to everything but if your're using mshtml; then you will not need this :-)

As per your other question ;-) I assume when you say IDocument2 you mean IHTMLDocument2 ?
0
 

Author Comment

by:AlexanderShkabarnya
ID: 9695787
But if I have an object of AxDHTMLEDLib.AxDHTMLEdit like
AxDHTMLEDLib.AxDHTMLEdit Edit;

I get an IHTMLDocument2 object fom there like:
mshtml.DHTMLDocument2 dom = Edit.DOM ;
and then I have to attach an event handler to it like onclick or any other.
How can I do that?
Sorry if I am asking silly questions :))  
0
 

Author Comment

by:AlexanderShkabarnya
ID: 9695841
Sorry, now I understand (to slow because of beer :)) )
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question