Handling all windows mouse click events in C# - c#

My Mouse has started to double click on single clicks, and I know this is a somewhat common issue. I am wanting to handle all mouse click events to fix this issue in software. I know "LowLevelMouseProc" has some decent control, but through many Google searches, I just can't seem to find what I need. There are two main functions I need is.
My application to be the first in the "CallNextHookEx" chain (The Main issue).
To be able to deny or force button state changes for on mouse press, and on mouse release.
and I do know about the "Left Mouse Button Fix" program, but it does not handle drags after a phantom click(after Mouse Release it does not allow for Mouse Press)

I would imagine that to filter everything the mouse puts through would take a colossal amount of time to fix a problem that will only get worse.
I know that this isn't a programmer's fix to the problem, but I had a similar trouble. I took an afternoon and fixed my mouse using some instructions I found on the web. I couldn't find the ones I used, but these are great. I would suggest that you have plenty of light and a magnifying glass.
Door number 3 is just buy a new mouse...

Related

Button no longer working in game window, but works fine in .exe build

So last night my game was working just fine. I log on today and I change an (unrelated) sprite and now for some reason the button won't be clicked in the game window during play mode. It does however work perfectly on an .exe build.
It's just the button that both players hit to say that they are ready to play the game.
Here are the relevant pieces of code pertaining to this button. The code that makes the button the code the button calls, etc.
https://gist.github.com/robofriven/ce26f24204dc0149c793
Sorry if this has already been asked, I do a lot of searching before asking questions and thus haven't had to ask anything yet, but this one has me stumped and I can't find anything similar anywhere. Thanks in advance for any and all help!
I figured it out. Apparently it has to do with the screen resolution not set to free aspect and that tweaking how the buttons respond to mouse clicks. It's kind of a phantom mouse thing where the mouse is not really pointing where it thinks it's pointing.

Show mouse pointer (sticky keys shift 5 times style)

I am working on a .NET program that reproduces mouse clicks however i would like to have it show that it is actually clicking,
is there a way to programatically trigger this sticky key things that shows circles around the mouse when you press shift 5 times?
Or for that matter maybe another effect just to make it clear for the user that the mouse is there and it is clicking right now. I also wish to avoid to have to actually activate sticky keys for the user since they're very annoying in my opinion.
I love you all, you make my days at work great and I take this occasion to thank you all for teaching me all the good stuff i learnt here. (:

to use or not to use ReleaseMouseCapture()?

Using methods that work in code might be fine but not knowing exactly what is going behind the scene is not such a good feeling. Fees like a gap or incomplete job.
I happened to find ReleaseMouseCapture() and have used in a method (OnMouseUp event) since seemed necessary but I noticed using or not using this method doesn't affect the visual part of my application at least
Can you give me some idea when we should be using it?
Thanks.
MSDN says:
When an object captures the mouse, all mouse related events are treated as if the object with mouse capture perform the event, even if the mouse pointer is over another object.
Depending on exactly what you're doing it may or may not makes sense. We would need some more information. But what it boils down to is, the object that captures it will listen and receive for all events from the mouse. This way you can better organize your mouse logic. For example, Dragging an object around a screen would be perfect for this since the object itself would be getting all the mouse events.
But, if you're only using ReleaseCaptureMouse so not sure why you're using it. Are you using CaptureMouse anywhere?
I use it whenever I write code to capture the mouse, and need to release the mouse capture when I'm finished.
A typical example would be dragging/dropping controls. When I begin a drag operation, I sometimes wish to have the application or a control capture the mouse so any movements made with the mouse are sent to the specific application or control, regardless of the mouse's actual position. When the user releases the mouse button, I need to release the mouse capture so the application/control stops receiving mouse events that its not interested in.
You only need to call ReleaseMouseCapture if you have called CaptureMouse, so in your case it doesn't sound like you need it.
Capturing the mouse means that the control receives mouse messages even when the mouse moves outside of the control's bounds. It is used for things like drag & drop where the drop will occur outside of the control.

How to create multiple Mouse controls which work separately in C#?

I am implementing a program in C# which can "Play" multiple instance of a game at the same time. The actions of the spawned instance is based on my actions. For example, when i click at position X, Y of the main instance, there will be mouse click at the same position in all other spawned instance.
I can do the mouse click, mouse down, mouse up by hooking the mouse event, and simulate the same mouse click on position based on the position of the each game window. However, this approach does not help if it comes to mouse dragging. And it has some setback in performance when i have to loop all my game instances to do a virtual mouse click.
I have found out that it is possible to create multiple mouse using the MultiPoint SDK from Microsoft. However, I could not find any documentation about if it is possible to simulate the multiple mouse click events (other than mine) in C#? If it is then how can i do it?
Thanks
Unless you are manipulating a program you didn't write, I think you might be using the wrong API for the job.
If you need to script multiple actions on multiple windows, you are probably better off running them sequentially. It will be easier to code and debug and you won't have to do anything special. Just script each action sequentially and then execute them.

Using System.Windows.DragDrop.DoDragDrop() with touch events?

I currently develop an application providing the possibility to drag&drop items from one ListBox to an other. This is working perfectly while using a mouse.
However, when trying to do the same with a touch screen (producing genuine touch events) this will not work.
In my logs I see that the TouchDown and Move is actually detected. But the call to System.Windows.DragDrop.DoDragDrop() does not block as it is the case during mouse usage. It immediately returns, so the drag gesture ends right after it started.
I assume that DragDrop.DoDragDrop() is geared for mouse usage only and depends on a MouseButtonDown during the complete process of dragging?!
So, is there an equivalent for using drag&drop with touch events?
Thanks for any hints
OK, sorry.
This is one of these questions which you are able to answer yourself... after some time.
And it even was not related to drag&drop itself.
Just this much:
Drag&Drop was working fine with touch. However, WPF swallowed an exception which occurred while determining a visual for dragging within an adorner. This logic had to be adjusted for touch events...

Categories