Solved

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

Posted on 2003-11-06
3
487 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
  • 2
3 Comments
 
LVL 6

Accepted Solution

by:
purpleblob earned 190 total points
Comment Utility
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
Comment Utility
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
Comment Utility
Sorry, now I understand (to slow because of beer :)) )
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

728 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now