C++ version of my AutoHotkey script.