Setting up system-wide hotkeys

You can see examples of global system-wide hotkeys almost in every application: media players, chats, different tray tools. The application can be minimized or even hidden, but you can control it by pressing hotkeys no matter what is in focus right now.

Unfortunately, .NET Framework doesn't contain convenient classes or methods for setting up global system-wide hotkeys. The only way to achieve this is to use the Windows API functions.