I Bestow Upon Thee “HotkeyAutoExecute”, My Game Screenshot Automator

HotkeyAutoExecute is a simple single-window tool that lets you manage a list of frequently used hotkeys, of which one is repeatedly executed in configurable intervals.

That was the TLDR blurp, and now let’s get into the details. This tool scratches an itch I had in 2020 when I wanted to simplify the process of taking game screenshots for my reviews. During intense gameplay moments, it is difficult to focus on the game and press a keyboard shortcut to take an image of on-screen action. Therefore, I hacked something that would do the job but was not quite baked to be open-sourced as an application. I have changed that now, and boy, was it more complicated than I would have liked.

Read More »

Convert QKeySequence of QKeySequenceEdit to Native Windows Virtual Key Codes VK_*

In a blog post in 2020, I described how to utilize the WinAPI SendInput() function to emulate hotkey presses to automatically take game screenshots for my video game reviews. While I intended to create a simple GUI application to do the task, I ended up with only a hack because of a massive boulder that Windows threw in my way. Or after me, chasing me down a narrow path.

Forget the boulder.

(Although it would be a fitting metaphor to describe Windows: tall, fat, and destructive to user privacy.)

I wanted a simple input field where the user can press a key sequence that will be executed repeatedly at an interval. Qt conveniently provides QKeySequenceEdit for this purpose, and when I tried to insert the Xbox Game Bar hotkey, it did not register. Well, it did, in that Windows took a screenshot. But it was not recorded by the widget. Windows seems to intercept and eat the key presses. That was when I decided to just hard-code my needs and call it a day.

Two years later, I figured that it was about damn time to fix this, and this is where I ran into issues with the translation of key codes from QKeySequenceEdit and QKeySequence to native Windows virtual key codes.

This is where our adventure begins.

Read More »