How to copy text underneath external program's context menu in vb.net
-
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?
-
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?
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[^]
-
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[^]
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
-
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
-
"Underneath"? What is underneath? Some sort of new technical term for "directly south"? I'm sorry, that was too facetious. Can't help you.
sorry, english is not my first language. I meant whatever is selected under the context menu
-
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?
-
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
thanks to everybody who replied. I found a solution to the problem
-
thanks to everybody who replied. I found a solution to the problem
would you share it with us?
-
would you share it with us?
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