Solved

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

Posted on 2003-11-06
3
541 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
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 Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

828 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