Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. How can I catch the Mouse Click?

How can I catch the Mouse Click?

Scheduled Pinned Locked Moved C#
questioncsharp
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Khoramdin
    wrote on last edited by
    #1

    Hello everyone, I have created a BHO using C#. The code works fine. I would like to detect mouse click on a particular bytton. The following is the SiteSet(). public class BHO : IObjectWithSite { private SHDocVw.WebBrowser webBrowser; private mshtml.HTMLDocument document; private mshtml.IHTMLDocument2 document2; private mshtml.HTMLElementEvents_Event events; public int SetSite(object site) { if (site != null) { webBrowser = (SHDocVw.WebBrowser)site; webBrowser.DocumentComplete += new SHDocVw.DWebBrowserEvents2_DocumentCompleteEventHandler(this.OnDocumentComplete); webBrowser.BeforeNavigate2 += new SHDocVw.DWebBrowserEvents2_BeforeNavigate2EventHandler(this.OnBeforeNavigate2); webBrowser.OnQuit += new SHDocVw.DWebBrowserEvents2_OnQuitEventHandler(this.OnQuit); webBrowser.NavigateComplete2 += new SHDocVw.DWebBrowserEvents2_NavigateComplete2EventHandler(this.NavigateComplete2); events.onclick += new mshtml.HTMLElementEvents_onclickEventHandler(this.OnElementMouseClick); } for the OnElementMouseClick function I have the following. public bool OnElementMouseClick() { MessageBox.Show("HelloWorld..."); return true; } . . . . But nothing really happens! Am I wrong to think that the above code should give me HelloWorld message once a button is click? Any information on this would be appriciated. Thank you very much. Khoramdin

    N 1 Reply Last reply
    0
    • K Khoramdin

      Hello everyone, I have created a BHO using C#. The code works fine. I would like to detect mouse click on a particular bytton. The following is the SiteSet(). public class BHO : IObjectWithSite { private SHDocVw.WebBrowser webBrowser; private mshtml.HTMLDocument document; private mshtml.IHTMLDocument2 document2; private mshtml.HTMLElementEvents_Event events; public int SetSite(object site) { if (site != null) { webBrowser = (SHDocVw.WebBrowser)site; webBrowser.DocumentComplete += new SHDocVw.DWebBrowserEvents2_DocumentCompleteEventHandler(this.OnDocumentComplete); webBrowser.BeforeNavigate2 += new SHDocVw.DWebBrowserEvents2_BeforeNavigate2EventHandler(this.OnBeforeNavigate2); webBrowser.OnQuit += new SHDocVw.DWebBrowserEvents2_OnQuitEventHandler(this.OnQuit); webBrowser.NavigateComplete2 += new SHDocVw.DWebBrowserEvents2_NavigateComplete2EventHandler(this.NavigateComplete2); events.onclick += new mshtml.HTMLElementEvents_onclickEventHandler(this.OnElementMouseClick); } for the OnElementMouseClick function I have the following. public bool OnElementMouseClick() { MessageBox.Show("HelloWorld..."); return true; } . . . . But nothing really happens! Am I wrong to think that the above code should give me HelloWorld message once a button is click? Any information on this would be appriciated. Thank you very much. Khoramdin

      N Offline
      N Offline
      Not Active
      wrote on last edited by
      #2

      http://www.codeproject.com/script/comments/forums.asp?msg=2323846&forumid=1649&mode=all&userid=3018268#xx2323846xx[^] Khoramdin wrote: I surly can stop and take my postings and problems to another forum Guess you didn't do this. You are persistent, but that won't help when you are so far over your head.


      only two letters away from being an asset

      K 1 Reply Last reply
      0
      • N Not Active

        http://www.codeproject.com/script/comments/forums.asp?msg=2323846&forumid=1649&mode=all&userid=3018268#xx2323846xx[^] Khoramdin wrote: I surly can stop and take my postings and problems to another forum Guess you didn't do this. You are persistent, but that won't help when you are so far over your head.


        only two letters away from being an asset

        K Offline
        K Offline
        Khoramdin
        wrote on last edited by
        #3

        Hello, You should POST the entire message rather than posting one section of it. If I remeber correctly, I said "If my messages bother you so much I surly can stop and take my postings and problems to another forum.". That is if you wish to be fare, mate! I still stand by my posting as I am not here to upset anyone. By the way, didn't take your advise and managed to solve the problem. Hey, not all of use get Free MVP title! *wink* Thank you for the reply. Khoramdin

        N 1 Reply Last reply
        0
        • K Khoramdin

          Hello, You should POST the entire message rather than posting one section of it. If I remeber correctly, I said "If my messages bother you so much I surly can stop and take my postings and problems to another forum.". That is if you wish to be fare, mate! I still stand by my posting as I am not here to upset anyone. By the way, didn't take your advise and managed to solve the problem. Hey, not all of use get Free MVP title! *wink* Thank you for the reply. Khoramdin

          N Offline
          N Offline
          Not Active
          wrote on last edited by
          #4

          Khoramdin wrote:

          You should POST the entire message

          You mean like the like above the reference?

          Khoramdin wrote:

          By the way, didn't take your advise and managed to solve the problem.

          Good for you. It is helpful to others to post the solution. If indeed you have solved it yourself. Perhaps someone with more experience just finished it for you. "wink* ;P


          only two letters away from being an asset

          K 1 Reply Last reply
          0
          • N Not Active

            Khoramdin wrote:

            You should POST the entire message

            You mean like the like above the reference?

            Khoramdin wrote:

            By the way, didn't take your advise and managed to solve the problem.

            Good for you. It is helpful to others to post the solution. If indeed you have solved it yourself. Perhaps someone with more experience just finished it for you. "wink* ;P


            only two letters away from being an asset

            K Offline
            K Offline
            Khoramdin
            wrote on last edited by
            #5

            ha ha ha... I wish someone had solved it for me, mate! I truly cracked my head on that BHO and believe me when I tell you that I was so excited when it got working! I cannot deny the fact that I read nearly a milliion posting and articles before I managed to get it up and running. I am actually thinking of creating a STEP BY STEP and detailed tutorial and submit it to codeproject regarding the BHO. My finding was that, expect one or two articles; there isn't much of information on BHO on Internet. It is good to see you have a delightful sense of humor. Happy thanx-giving, mate.:rose: Khoramdin

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups