c# AxWebBrowser Document OnClick Disables browser

It seems like there is a lot of questions like this, but cant find the answer.

I've implemented OnClick event like it this thread: http://support.microsoft.com/?kbid=312777 But the result is that browser is completely disabled (scrollbar, controls...).

I've searcher the internet and couldn't find clear solution.

Some says that has to be created new class inherited from WsbBrowser and then overload those events. Other says that answer is here http://www.experts-exchange.com/Programming/Languages/C_Sharp/Q_20661377.html but i dont have account.

 private void FormBrowser_DocumentComplete(object sender, DWebBrowserEvents2_DocumentCompleteEvent e)
        mshtml.HTMLDocument doc;
        doc = (mshtml.HTMLDocument)FormBrowser.Document;
        mshtml.HTMLDocumentEvents2_Event iEvent;
        iEvent = (mshtml.HTMLDocumentEvents2_Event)doc;
        iEvent.onclick += new HTMLDocumentEvents2_onclickEventHandler(ClickEventHandler);

private bool ClickEventHandler(mshtml.IHTMLEventObj e)
        return true;

Who knows solution?


Well i've found a way how to handle onclick events for AxWebBrowser HTML elements. Here is what you need to do:

First we need to create a dispatcher class:

public class DispatcherSketchClass
        public DispatcherSketchClass()
        public void DefaultMethod()
        //this method will be called

Then we just attach this dispather to some element:

 void AddDispatcher(AxWebBrowser browser)
            IHTMLDocument2 doc = (IHTMLDocument2)browser.Document;

            foreach (IHTMLElement VARIABLE in doc.all)
                //find right element
                if (VARIABLE.title == "the name")
                    // attach here               
                    DispatcherClass dp = new DispatcherClass();
                    VARIABLE.onclick = dp;


Hope this helps.

Need Your Help

accessing to classes of app from dex file by classloader

android classloader dex

I have a app that recieve a dex file from server then save it on sdcard and load it for

Using Redis to Scale Web Services

.net wcf caching redis scalability

In my latest project, I have to write a web service API to return data from a database.