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. Visual Basic
  4. How to copy text underneath external program's context menu in vb.net

How to copy text underneath external program's context menu in vb.net

Scheduled Pinned Locked Moved Visual Basic
tutorialquestioncsharpannouncement
9 Posts 4 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.
  • C Offline
    C Offline
    Craig Haywood
    wrote on last edited by
    #1

    I would like to know if anyone can give me an example of how to copy text underneath an external program's context menu. I am playing around with code for basic mouse gestures. When I perform, for example an upwards movement with the right mouse button held in, my program send Ctrl+C to copy whatever is selected when I release the right mouse button. However, lets say I am trying to copy text selected in notepad, If I release the right mouse button over the notepad window, notepad pops up its context menu before my copy command can execute. You can simulate this by selecting text in notepad, right click and while the contect menu is showing, try pressing ctrl+c. I am looking for a way to copy what is selected in the foreground window without having to close the context menu. The reason I don't want to close the context menu is that at times you might actually need it, like when you right-click and drag a file in explorer. If my program would esc the context menu then explorer won't pop up a context menu to move or copy the file to where you dragged it. I hope this makes sense. Anyone?

    R L 2 Replies Last reply
    0
    • C Craig Haywood

      I would like to know if anyone can give me an example of how to copy text underneath an external program's context menu. I am playing around with code for basic mouse gestures. When I perform, for example an upwards movement with the right mouse button held in, my program send Ctrl+C to copy whatever is selected when I release the right mouse button. However, lets say I am trying to copy text selected in notepad, If I release the right mouse button over the notepad window, notepad pops up its context menu before my copy command can execute. You can simulate this by selecting text in notepad, right click and while the contect menu is showing, try pressing ctrl+c. I am looking for a way to copy what is selected in the foreground window without having to close the context menu. The reason I don't want to close the context menu is that at times you might actually need it, like when you right-click and drag a file in explorer. If my program would esc the context menu then explorer won't pop up a context menu to move or copy the file to where you dragged it. I hope this makes sense. Anyone?

      R Offline
      R Offline
      RedDk
      wrote on last edited by
      #2

      Craig Haywood wrote:

      selecting text in notepad, right click and while the contect menu is showing, try pressing ctrl+c

      With the context menu open, moving the pointer to "copy" does the same thing ... what is on clipboard ... arghh (brain frozen) What are you trying to do? Better question, what VB.NET tools do you have available to you to use as a programming platform? Are you refering to some sort of macro recorder by any chance. Recording mouse movement and behavioral clicks based upon what's on the screen for playback as a mouse behavior repeat in an overlay scenario? There's this: Writing a Macro Recorder/Player using Win32 Journal Hooks[^]

      C 1 Reply Last reply
      0
      • R RedDk

        Craig Haywood wrote:

        selecting text in notepad, right click and while the contect menu is showing, try pressing ctrl+c

        With the context menu open, moving the pointer to "copy" does the same thing ... what is on clipboard ... arghh (brain frozen) What are you trying to do? Better question, what VB.NET tools do you have available to you to use as a programming platform? Are you refering to some sort of macro recorder by any chance. Recording mouse movement and behavioral clicks based upon what's on the screen for playback as a mouse behavior repeat in an overlay scenario? There's this: Writing a Macro Recorder/Player using Win32 Journal Hooks[^]

        C Offline
        C Offline
        Craig Haywood
        wrote on last edited by
        #3

        RedDk wrote:

        With the context menu open, moving the pointer to "copy" does the same thing

        I can't programatically move the pointer as not all programs context menus will have the copy command at the same place. What do you mean what VB.net tools do I have? I use visual studio 2012

        R 1 Reply Last reply
        0
        • C Craig Haywood

          RedDk wrote:

          With the context menu open, moving the pointer to "copy" does the same thing

          I can't programatically move the pointer as not all programs context menus will have the copy command at the same place. What do you mean what VB.net tools do I have? I use visual studio 2012

          R Offline
          R Offline
          RedDk
          wrote on last edited by
          #4

          "Underneath"? What is underneath? Some sort of new technical term for "directly south"? I'm sorry, that was too facetious. Can't help you.

          C 1 Reply Last reply
          0
          • R RedDk

            "Underneath"? What is underneath? Some sort of new technical term for "directly south"? I'm sorry, that was too facetious. Can't help you.

            C Offline
            C Offline
            Craig Haywood
            wrote on last edited by
            #5

            sorry, english is not my first language. I meant whatever is selected under the context menu

            1 Reply Last reply
            0
            • C Craig Haywood

              I would like to know if anyone can give me an example of how to copy text underneath an external program's context menu. I am playing around with code for basic mouse gestures. When I perform, for example an upwards movement with the right mouse button held in, my program send Ctrl+C to copy whatever is selected when I release the right mouse button. However, lets say I am trying to copy text selected in notepad, If I release the right mouse button over the notepad window, notepad pops up its context menu before my copy command can execute. You can simulate this by selecting text in notepad, right click and while the contect menu is showing, try pressing ctrl+c. I am looking for a way to copy what is selected in the foreground window without having to close the context menu. The reason I don't want to close the context menu is that at times you might actually need it, like when you right-click and drag a file in explorer. If my program would esc the context menu then explorer won't pop up a context menu to move or copy the file to where you dragged it. I hope this makes sense. Anyone?

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              You cannot capture text just by moving the mouse over a window that belongs to a different application. As soon as you do that all mouse messages will be sent to the owner of that window, which in this case, is Notepad.

              Veni, vidi, abiit domum

              C 1 Reply Last reply
              0
              • L Lost User

                You cannot capture text just by moving the mouse over a window that belongs to a different application. As soon as you do that all mouse messages will be sent to the owner of that window, which in this case, is Notepad.

                Veni, vidi, abiit domum

                C Offline
                C Offline
                Craig Haywood
                wrote on last edited by
                #7

                thanks to everybody who replied. I found a solution to the problem

                U 1 Reply Last reply
                0
                • C Craig Haywood

                  thanks to everybody who replied. I found a solution to the problem

                  U Offline
                  U Offline
                  User 13259903
                  wrote on last edited by
                  #8

                  would you share it with us?

                  C 1 Reply Last reply
                  0
                  • U User 13259903

                    would you share it with us?

                    C Offline
                    C Offline
                    Craig Haywood
                    wrote on last edited by
                    #9

                    I ended using a global mouse hook to perform (and draw) mouse gestures. That way I can call my own procedures when the right mouse button down/up event is fired

                    Add instant productivity to any windows application... http://www.funmouse.org

                    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