title: How do I take a screenshot of FSX using a C++ Program?
body: <p>I'm working on a program that works with the game &quot;Microsoft Flight Simulator X: Steam Edition.&quot; One of the things I need to do with it is take a screenshot of the game. I've tried several different solutions to no avail. To take the screenshot I am trying to issue a F12 keypress to trigger Steam to take a screenshot. Here's a couple of examples of what I tried:</p>
  <pre><code>keybd_event(VK_F12, 0, 0, 0);
  Sleep(250);
  keybd_event(VK_F12, 0, KEYEVENTF_KEYUP, 0);
  </code></pre>
  <p>This second example confirmed that the keypress is being registered, but no screenshots are being taken.</p>
  <pre><code>INPUT input[1] = {};
  input[0].type = INPUT_KEYBOARD;
  input[0].ki.wVk = VK_F12;
  UINT test = SendInput(ARRAYSIZE(input), input, sizeof(INPUT));
  std::cout &lt;&lt; test;
  </code></pre>
  <p>If anyone has any ideas on how to get this to work, or other ways to take a screenshot, please let me know!</p>