Show mouse pointer (sticky keys shift 5 times style) - c#

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. (:

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.

Handling all windows mouse click events in 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...

Keyboard button "event" efficiency in XNA

I have been trying to figure it out for myself, but all tutorials online and everything I could find, does not really explain my question, so I hope someone here can help me.
I so far have only worked with C# mainly using WPF and if I want to raise an event whey a key is pressed on the keyboard, I simply use the KeyDown event. There I can easily identify the pressed key by e.Key.
Now in XNA everything I have seen is using KeyboardState state = Keyboard.GetState(); to get the state of the keyboard and constantly check in the Update()-method if e.g. state.IsKeyDown(Keys.Left); returns true of false.
And my question is: Is that not really inefficient? If for example my game uses 15 keys for input, I would get the keyboard state and check every single of those 15 keys and that 30 times a second. Is there a reason, why it seems to be so common to use this approach in XNA?
The only explanation I could think of, is to make sure everything remains in the Update-method so it will definietly be executed, such that no delayed events cause problems in the game.
A form application and a video game is two completely different beast. In a good video game, the code uses all the threads available. For this reason, having an event start a new thread while none are available is obviously a bad thing, as it could hang another critical thread. There is no loose threads in a game.
A form is reactive to your input. It does virtually nothing while you don't do something. Nobody care if pressing a button in a form take 0.2-0.5 sec of reaction time.
A game is pro-active, and keep checking for them. It update itself for every frame anyway for the AI, physic, sounds, FX, animation and so one, and what goes on screen is always linked to what the user do. The input should always be resolved when the code get to updating the player's actions. So you have to test them anyway! On top, you want the best reaction time possible to your input and the only way to do it is to constantly check them. A 0.2 sec latency to a user input can make a game unplayable. There's coders whose role is solely to reduce the input latency to a minimum.

Emulate held down key on keyboard?

I know SendKeys can emulate typing and send individual keystrokes but I'm looking for a way to emulate holding down a key. My goal is an app that acts as a joypad for a windowed game. Imagine holding a tablet PC and having arrow keys and basic buttons on either side of the screen and pressing them emulates keyboard presses which a game then receives. That's my goal.
When a finger presses down on a button, I want to translate that to pressing down on a keyboard key. Upon releasing that button, I want to release that key. I know this'll probably require some low level code and I'm ok with that.
NOTE: I do NOT want to emulate these events in my own app, but system wide. I'm writing this for an XNA game of mine and it's not listening for direct, focus key events, it's checking the state of the keyboard, (as I assume most games do) and responding to that. I want my app to trick my game into thinking a key is held down at the proper times.
If you want to emulate it system-wide, you can use SendInput from Core.dll. There are more detailed information on how to do that here.
However, it is very rare, that you will actually need that. Instead, you should try to manipulate with only your own app (it seems more like that is what you need in this case). You can simply just make variables for all the keys, you want to read, and then read those variables from both keyboard AND tablet.
EDIT
oh, this link will probably be better...

Making "global" hotkeys in WPF

I'm programming an application consisting of three usercontrols in an main window.
In one of the usercontrols, there's a slider that needs to be controllable by keyboard input. The left arrow should decrease value, right button increase and so on. I have this work, but only when the slider has focus. If some other control has focus, I cant make it work at all.
Is it possible to define "global" hotkeys? IE keys that trigger the same event or function, no matter where the focus is? Hope I've made myself clear enough...
I have never tried this but If you have a command registered at the main window level with keys associated to it that might work. Keep in mind I have never done this but it is some thing you can try. If you are new to commands here is a blog post about it.
I have never rolled this my self but when using the built in past command I actually had to put code in to prevent it from happening in some cases.
I know this probably isn't much help but I hope it is enough to get you started.

Categories