mouse-hook

How can I set cursor position from mouse hook in Windows?

瘦欲@ 提交于 2019-12-24 00:54:13
问题 I'm trying to create a little app that will detect when the mouse cursor moves to the edge of the screen and will move it to the opposite edge, to create a continuous desktop effect, if that makes sense. Below is some code from someone else (the mouse hook part) I adapted by added the SetCursorPos to move the mouse to a fixed position for now. When I run it, SetCursorPos returns true, which I assume means the call succeeded, but the mouse does not move. I read somewhere something about

Running a C++ Event Loop WITHOUT using QT

可紊 提交于 2019-12-23 02:18:46
问题 I have been trying to develop a background Windows application in c++ to capture system wide keystrokes and mouse clicks (no I'm not writing a keystroke logger, just keystroke rates!). For this I have figured out that I need to use Windows Hooks and I came across this excellent video which gave me a basic example. Unfortunately, it uses the QT framework and for licencing (and other time based) reasons, this is not available to me currently. All I need to be able to do is adapt the code so

C# low level mouse hook and form event handling

耗尽温柔 提交于 2019-12-22 05:36:12
问题 I'm using a simple form generated by VS 2010 which contains 2 buttons, start and stop. Start triggers WH_MOUSE_LL using SetWindowsHookEx, and stop stops the hook. The hook works fine and I mange to "replace" middle mouse button click with double click, the only problem I have is clicking on Minimize/Maximize/Close buttons of the form, it seems that there is some sort of "event race" between the hook and events called by buttons mentioned above. It reflects on the fact that when you press one

Erroneous Mouse Coordinates Returned from Low Level Mouse Hook C#

社会主义新天地 提交于 2019-12-13 23:07:48
问题 I'm building a WPF application with some hackery involved to embed Form elements on the same render layer. Essentially what I do is I render the form off-screen and have a mock-up of the form in a WPF image. I also have a low level mouse hook which steals events from the WPF application if they are destined for the Form mock-up and instead use PostMessage(...) to send the events off to the hidden form element. If I return a non-zero value from my hook procedure indicating to eat the event

Global Key/MouseHook with UI

馋奶兔 提交于 2019-12-12 00:19:29
问题 I want to make a C# Application with a Keyboard and Mouse on screen. Every Key or Button that is clicked should be seen in this Application by for example coloring one of the keys ( i know how to do that ). This should also work if the Application is not focused. Currently i am using a global Key- and Mousehook which works fine. The problem is, the Keyhook does only intercept one Key at a time which means i can only show on Key at a time. I want to be able to show multiple keys at a time on

How can I disable mouse click event system wide using C#?

大憨熊 提交于 2019-12-09 06:45:10
问题 Hey guys, I have a laptop with a very sensitive touch pad, and wanted to code a small program that could block the mouse input when I was typing a paper or something. I didn't think it would be hard to do, considering everything I've seen on low-level hooks, but I was wrong (astounding, right?). I looked at a few examples, but the examples I've seen either block both keyboard and mouse, or just hide the mouse. Any help with this would be great. 回答1: As you mentioned, you can do this using a

Is there a .NET library for sending keystrokes, mouse clicks, mouse movements and other input? Similar to AutoHotKey but for .NET library use?

假装没事ソ 提交于 2019-12-08 02:27:43
问题 I'm looking to essentially write code similar to what I can do with AutoHotKey, only in .NET and C#, because it's a much more robust environment. I didn't know if there was a wrapper library available for these sorts of hooks or not. Does anyone know of a library that does this for .NET? 回答1: This actually looks pretty promising, I haven't tested it yet, but it's at least a good starting point. Not too bad considering it's on CodeProject. lol. 回答2: For sending keys you can use System.Windows

Hooking the 3rd X-Mouse button?

青春壹個敷衍的年華 提交于 2019-12-07 13:35:19
问题 I wrote a low-level mouse hook in C#, which should capture XBUTTON events. For the 1st and 2nd xButton it works just fine, but there is no message for the 3rd xButton on my mouse. It seems like there is no possible way to capture events for that button? I have a gaming mouse and there, between the two first xButtons, is a third xButton. When I click it, nothing happens, so I wanted to write a custom C# Mouse-Hook app to program a custom behaviour for that button... 回答1: That's correct. The

Set mouse position not working c#

落爺英雄遲暮 提交于 2019-12-07 04:06:27
问题 I've been trying to write a small utility that will modify the boundaries of where my mouse can go on the whole screen. I've used the the global mouse hook library that I found here (I'm using version 1), and then pass the mouse position information from the event it generates to my own function (just a test to see it working for now). internal void ProcessMouseEvent(System.Drawing.Point point) { Cursor.Position = new Point(50,50); } When running it, the mouse does appear to flash to the

Running a C++ Event Loop WITHOUT using QT

六月ゝ 毕业季﹏ 提交于 2019-12-06 15:26:02
I have been trying to develop a background Windows application in c++ to capture system wide keystrokes and mouse clicks (no I'm not writing a keystroke logger, just keystroke rates!). For this I have figured out that I need to use Windows Hooks and I came across this excellent video which gave me a basic example. Unfortunately, it uses the QT framework and for licencing (and other time based) reasons, this is not available to me currently. All I need to be able to do is adapt the code so that it does not require the "return a.exec()" line (which I believe is what starts off the event loop). A