I am creating a program which will automate some office works. Is some cases I must copy students' numbers to clipboard and paste them some where else.
I need to map "Ctrl+V" (paste) to mouse Right click while running my App So When I right click some where, instead of normal mouse right click, it do pasting.
How Can I make such thing via C#?
Related
TLDR: How to programmatically hide the mouse cursor for entire desktop no matter the application that has focus?
Even though I have "Hide pointer while typing" enabled in Windows Mouse Options, it doesn't work for most windows. It only seems to work on windows that use the standard Windows text box control (such as notepad.exe). Everywhere else, the cursor stays right on top of whatever I'm typing.
I want to programmatically hide the mouse cursor across the entire desktop no matter what application has focus, when I execute a specific action (for example, a hotkey is pressed). Then, when the mouse is moved, I want the cursor to reappear.
I can handle the hotkey etc. I just need to know how to hide the cursor.
What I have tried:
Cursor.Hide method only hides cursor for the current form. This is not an acceptable solution.
Windows API ShowCursor function - just doesn't seem to work at all... the cursor never disappears.
Currently my workaround is to listen for the Spacebar to be pressed (implies I'm typing more than a few characters), then move the mouse cursor to the top corner of the desktop, out of the way. However, this is not an ideal solution as it requires the mouse to be moved a lot to return to the original position, as well as messing up mouse position in apps such as Sketchup when entering dimensions containing spaces. I would prefer that the cursor simply become invisible in its current location, then reappear at the same location when moving the mouse, as it is supposed to work with the "Hide pointer when typing" option.
I'm not tied to C# but it's just easy to compile into an executable for Windows, which I can launch on Windows startup.
Thank you for any help!
I would like to know if it is possible to, while running a WPF window application in Visual Studio, wait for the user to click anywhere on the screen (not necessarily inside the window of my application - for the purpose of my application, the click would most likely occur inside a browser page) and then gather the information about the click (like inside the window of which application the user clicked, or the selector of the html element the user clicked)? I know this question might be very confunsing but this is basically my last resort since researching on the Internet hasn't helped me much. Just to provide a better idea of what I seek, it's like what the 'Extract Structured Data' Activity does in UiPath. Oh and I'm using C# by the way.
You can try and use this external library called GlobalMouseHook.
This library allows you to tap keyboard and mouse, detect and record their activity even when an application is inactive and runs in background.
Here is what you can do with this library:
Mouse coordinates
Mouse buttons clicked
Mouse drag actions
Mouse wheel scrolls
Key presses and releases
Special key states
Hope this helps.
i've new mouse gaming that have several additional button. this mouse doesn't include application to allow user modifying function for the button. i like to change just like sharpkeys do. If there's any application that can allow me, can you tell me what is it? Or if there's no application yet, i im interested to starting developing.
for development choice, i've 2 option, develop with electron(javascript) or c#(the same programming language used by sharpkeys). can you recommend me which one is better?
update:
from this following link
https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button
we can detect that every button has their own key code, my mouse button additional key code is 3 and 4. how can i modify these key become a same function like home/end in my computer keyboard?
You didn't state clearly about what you want to achieve.
Press a mouse button and act like "go to top of the page" ( what home key does ).
Press a mouse button and act like press home, and press home is defined by yourself.
I'll try to answer both.
According to your link, I found this
For solution 1.
You need mouse button act as "go to the top of page", you shall dig about how to "go to
the top of page".
For solution 2.
Keyboard event will tell you which key is pressed.
You may route mouse event and keyboard event to the same function.
i'm also found other application for alternatives for the solution to my problem, It's Mouse Manager. However, i'm still interested to develop application that can customize the mouse gaming button, for future development.
I'd like to have a method executed whenever left mouse button is clicked in a another application, and another method executed whenever left mouse button is released. I've searched around, and the only solutions I can find eather don't work, or is too complicated for me to modify. Could someone help me with this? (C#)
You can use a global mouse hook for that. ( http://www.codeproject.com/Articles/7294/Processing-Global-Mouse-and-Keyboard-Hooks-in-C )
It is easy to implement, just download the Source Files [Version 2 (http://www.codeproject.com/KB/cs/globalhook/globalhook2_src.zip)]. To play with it (I just tried and it worked for me), it does what you need to do and and more, and it is easy to modify.
I'm trying to integrate a third party hardware to one of my existing projects . Basically the hardware has two buttons with different color leds on each button.
I am able to open and close each led with the library/manual which is provided by the manufacturer without any problem. My problem is I can not handle its buttons click events from any kind of software C/C#/VB etc...
I mean when I press one of its buttons it acts like any input device and effects the cursors current position like a keyboard key or mouse click due the opened program(For example if Ms Word is opened currently it acts like space key?). The DLL or manual has no special function for this purpose (like a mouse click event?).
So what I'm asking is there any general way to handle any external device button click inside a C# program? How the currently running software suppose to understand a button is clicked and enter the desired method in the code?
Any clue or tip would be highly appreciated.
Thanks...