title: C# How to send a hotkey globally (needed for a background process, running in system tray)
body: <p>I am writing a program to automate some work for me. </p>
  
  <p>I have another program (OBS Studio) installed, which I use to capture video. OBS Studio is minimized to the system tray and listens to my configured hotkey CTRL + 1. </p>
  
  <p>When I press CTRL + 1 anywhere, the software starts recording. It does not matter which application is in the foreground.</p>
  
  <p>I am trying to do the same thing from my application, send a "global" hotkey. I have spend hours trying to achieve this, but without any result. SendKeys only works for the current open window (which does not exist), no results with PostMessage either and I tried the wrapper "InputSimulator"</p>
  
  <p>So, to summarize:</p>
  
  <ul>
  <li>Is it possible to send a hotkey/keystroke globally (for every application?)</li>
  <li>If not, how would I send a hotkey to a program that is running in the background, without a window? I don't want to bring the app to the foreground.</li>
  </ul>
  
  <p>Hopefully someone with a deeper understanding of these concepts can guide me...</p>
  
  <p>I've found similar questions, but they remain unanswered:</p>
  
  <p><a href="https://stackoverflow.com/questions/36207594/send-global-keystroke-fake-a-global-hotkey-from-a-winforms-application">Send global keystroke / fake a global hotkey from a Winforms application</a></p>
  
  <p>Sources I studied (among others):</p>
  
  <p><a href="https://msdn.microsoft.com/en-us/library/system.windows.forms.sendkeys(v=vs.110).aspx" rel="nofollow noreferrer">https://msdn.microsoft.com/en-us/library/system.windows.forms.sendkeys(v=vs.110).aspx</a>
  <a href="https://dailyoverdose.wordpress.com/2009/10/28/postmessage-and-sendmessage/" rel="nofollow noreferrer">https://dailyoverdose.wordpress.com/2009/10/28/postmessage-and-sendmessage/</a>
  <a href="https://ourcodeworld.com/articles/read/520/simulating-keypress-in-the-right-way-using-inputsimulator-with-csharp-in-winforms" rel="nofollow noreferrer">https://ourcodeworld.com/articles/read/520/simulating-keypress-in-the-right-way-using-inputsimulator-with-csharp-in-winforms</a></p>