using mshtml how to use oncontextmenu inC#

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nilwarude85
    New Member
    • Jun 2016
    • 1

    using mshtml how to use oncontextmenu inC#

    private HTMLDocumentEve nts2_Event _docEvent;
    private mshtml.HTMLDocu ment doc = null;
    // private string _content = string.empty;

    void gmailurl_Docume ntComplete(obje ct pDisp, ref object URL)
    {
    //doc = null;
    //mshtml.IHTMLDoc ument2 doc = (IHTMLDocument2 )gmailurl.Docum ent;

    //mshtml.HTMLDocu mentEvents2_Eve nt iEvent = (mshtml.HTMLDoc umentEvents2_Ev ent)doc;
    //iEvent.oncontex tmenu += new HTMLDocumentEve nts2_oncontextm enuEventHandler (ClickEventHand ler);
    //foreach (IHTMLElement link1 in doc.all)
    //{
    // HTMLButtonEleme nt el = link1 as HTMLButtonEleme nt;


    //}
    //foreach (IHTMLElement l in doc.all)
    //{


    //}

    //foreach (HtmlElement element in doc.all)
    //{
    // HTMLButtonEleme nt btn = lk as HTMLButtonEleme nt;


    //}
    //foreach (IHTMLElement link in doc.links)
    //{
    // // HtmlElement ele=link.

    // HTMLAnchorEleme nt anchor = link as HTMLAnchorEleme nt;
    // if (anchor != null)
    // {
    // HTMLAnchorEvent s_Event handler = anchor as HTMLAnchorEvent s_Event;
    // if (handler != null)
    // {
    // handler.onconte xtmenu += new HTMLAnchorEvent s_oncontextmenu EventHandler(de legate()
    // {
    // MessageBox.Show ("You clicks the link: " + anchor.href);
    // return true;
    // });

    // }
    // }
    //}

    //_docEvent = (HTMLDocumentEv ents2_Event)gma ilurl.Document;
    //_docEvent.oncon textmenu += new HTMLDocumentEve nts2_oncontextm enuEventHandler (_docEvent_onco ntextmenu);

    //if (gmailurl.Docum ent != null)
    //{
    // _docEvent = (HTMLDocumentEv ents2_Event)gma ilurl.Document;
    // _docEvent.oncon textmenu += new HTMLDocumentEve nts2_oncontextm enuEventHandler (_docEvent_onco ntextmenu);
    //}
    if (doc == null)
    {
    doc = (mshtml.HTMLDoc ument)gmailurl. Document;

    mshtml.HTMLDocu mentEvents2_Eve nt iEvent = (mshtml.HTMLDoc umentEvents2_Ev ent)doc;
    // iEvent.onkeydow n += new mshtml.HTMLDocu mentEvents2_onk eydownEventHand ler(keyDown);
    iEvent.oncontex tmenu += new HTMLDocumentEve nts2_oncontextm enuEventHandler (ClickEventHand ler);
    doc.focus();
    }

    above code is working but textbox is disabled so give me appropriate answer
Working...