title: Accepting input while out of focus
body: <p>I've never actual asked a question on Stack Overflow, though just about every programming question I've ever had I found an answer here. Sadly today is not one of those days.</p>
  
  <p>I've spent all day Googling, browsing the win32 api, and trying all sorts of things, but I just can't find the damn answer I'm looking for. </p>
  
  <p>Here's the situation: I've got a Unity project I've created, it uses input from a joystick, there are other components to this project outside of unity, but that's irrelevant, the base of my problem is this: How can I make an application continue to accept input while it's out of focus/Inactive. </p>
  
  <p>I know for a fact that it can be done because Borderlands 2 can do it (I found that out yesterday when I first started trying to find an answer, which was aggravating because that proves there is a way, and I'm failing to find it).</p>
  
  <p>At the very least if someone knows how to do this for mouse or keyboard, that would be helpful enough to allow me to figure out how to apply it to a joystick.</p>
  
  <p>Some helpful details: I'm an avid and experienced programmer, and I've been coding in: C/C++, C#, Java, and a number of scripting languages for many years. It is what I do as a hobby, for my job, in my spare time, <s>while I'm asleep</s>...</p>
  
  <p>Things I've done / tried: </p>
  
  <ul>
  <li>using <code>SetFocus</code> + <code>SetActive</code> from <code>user32</code> &amp; passing <code>null</code> as the window
  losing focus</li>
  <li>adding the <code>WM_KILLFOCUS</code> to the ignore list of the other window I want to read input while in background</li>
  <li>using <code>sendmessage</code> to trick the other window into reading input</li>
  <li><p>overriding the <code>inputstream</code> of the application (but this was useless sense I couldn't figure out how to send joystick input over
  the stream, and also because It still didn't solve the problem sense
  if that other application was out of focus (i.e. I open notepad),
  input would stop.</p></li>
  <li><p>I also searched for a way to make a Unity standalone game/project/application accept input while in background, but that yielded nothing.</p></li>
  </ul>