Global Hotkey Recognition in WinForms

So as part of my Google Play Music Desktop Player project I needed to listen for certain keypresses even when the application wasn't in focus. In practice I assumed this would be straight forward but I ended up scratching my head in puzzlement for hours before stumbling accross a semi-working solution and then making it work effectively. Making it easy for you There is a handy class which I found on a Gist and modified to work effectively using System; using System.Collections.Generic; using System.Text; using System.Runtime.InteropServices; using System.Windows.Forms; using System.ComponentModel; namespace Utilities »