0

I'm trying to make a key visualizer for my son when he plays video games. It's an overlay at the top of your screen that shows the W, A, S, D, SpaceBar, Shift, Right Mouse and Left Mouse which change color when the buttons are clicked.

The only problem is, you have to have the form focused to detect mouse clicks/key presses, and I'm not sure where to start or what to use to code this.

If anyone could help me with only the mouse clicks (I've already started to get the general idea of key presses) that would be great. Thank you in advance!

  • [Global mouse event handler](https://stackoverflow.com/q/11607133/8967612). It's for C# but the idea is the same. – 41686d6564 stands w. Palestine Jul 31 '20 at 22:03
  • Besides global hooks (you'd need both WH_MOUSE_LL anad WH_KEYBOARD_LL), your only other option is to POLL for the states using a Timer and the `GetAsyncKeyState()` API. – Idle_Mind Jul 31 '20 at 23:23
  • You mean like https://www.youtube.com/watch?v=qSUDfzUkwnc or https://www.addictivetips.com/windows-tips/show-keystrokes-on-windows-10/ ? I refer to this because a_ it already exists, b) it might be a wheel that solves your problem without having to invent one and c) it's open source and .net so you can look how it wotrks and modify it if you need https://github.com/Code52/carnac – Caius Jard Aug 01 '20 at 08:57

0 Answers0