Solved

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

Posted on 2003-11-06
3
555 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 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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
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.
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

696 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