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. Is there a way to detect a mouse click in a Word document in my form?

Is there a way to detect a mouse click in a Word document in my form?

Scheduled Pinned Locked Moved C#
question
6 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.
  • F Offline
    F Offline
    fiaolle
    wrote on last edited by
    #1

    Hi I'm woundering if there is a way to detect a mouse click in a Word document that I have opened in my Form. Many thanks Fia

    L 1 Reply Last reply
    0
    • F fiaolle

      Hi I'm woundering if there is a way to detect a mouse click in a Word document that I have opened in my Form. Many thanks Fia

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      AFAIK if you call Mouse.Capture()[^] the control specified will get the mouse events, no matter where the mouse is going, or what window has focus. But then, if you hover a Word document, you won't be able to select words, set the caret, or do anything to it. :)

      Luc Pattyn [My Articles] Nil Volentibus Arduum iSad

      F 1 Reply Last reply
      0
      • L Luc Pattyn

        AFAIK if you call Mouse.Capture()[^] the control specified will get the mouse events, no matter where the mouse is going, or what window has focus. But then, if you hover a Word document, you won't be able to select words, set the caret, or do anything to it. :)

        Luc Pattyn [My Articles] Nil Volentibus Arduum iSad

        F Offline
        F Offline
        fiaolle
        wrote on last edited by
        #3

        Hi Thank you for the answer. Can you give me a code example. The only thing I want to know if the users click on the word document. I'm using these objects

        ap = new Word.Application();
        doc = ap.Documents.Open(path, ReadOnly: false, Visible: true);

        Many Thanks Fia

        L 1 Reply Last reply
        0
        • F fiaolle

          Hi Thank you for the answer. Can you give me a code example. The only thing I want to know if the users click on the word document. I'm using these objects

          ap = new Word.Application();
          doc = ap.Documents.Open(path, ReadOnly: false, Visible: true);

          Many Thanks Fia

          L Offline
          L Offline
          Luc Pattyn
          wrote on last edited by
          #4

          fiaolle wrote:

          Can you give me a code example

          I don't have any. I suggest you read MSDN, and use Google. It has nothing to do with Word, Mouse.Capture is a general-purpose tool. :)

          Luc Pattyn [My Articles] Nil Volentibus Arduum iSad

          F 1 Reply Last reply
          0
          • L Luc Pattyn

            fiaolle wrote:

            Can you give me a code example

            I don't have any. I suggest you read MSDN, and use Google. It has nothing to do with Word, Mouse.Capture is a general-purpose tool. :)

            Luc Pattyn [My Articles] Nil Volentibus Arduum iSad

            F Offline
            F Offline
            fiaolle
            wrote on last edited by
            #5

            Hi I'm sorry I haven't found anything that helps me or I'm not understanding the examples. Is there anybody who can help with some code how to do this. Please Thanks Fia

            F 1 Reply Last reply
            0
            • F fiaolle

              Hi I'm sorry I haven't found anything that helps me or I'm not understanding the examples. Is there anybody who can help with some code how to do this. Please Thanks Fia

              F Offline
              F Offline
              fiaolle
              wrote on last edited by
              #6

              Hi :-D Thanks for all the replies. I have found a solution. Microsoft.Office.Interop.Word.Application ap; Microsoft.Office.Interop.Word.Document doc;

              ap = new Word.Application();
              ap.WindowSelectionChange +=new ApplicationEvents4_WindowSelectionChangeEventHandler(ap_WindowSelectionChange);
              doc = ap.Documents.Open(path, ReadOnly: false, Visible: true);

              private void ap_WindowSelectionChange(Microsoft.Office.Interop.Word.Selection Sel)
              {
              }

              When I click in the doc I have opened the event ap_WindowSelectionChange runs. Fia

              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