简体   繁体   English

如何使用 C++ 程序截取 FSX 的屏幕截图?

[英]How do I take a screenshot of FSX using a C++ Program?

I'm working on a program that works with the game "Microsoft Flight Simulator X: Steam Edition."我正在开发一个适用于游戏“Microsoft Flight Simulator X:Steam Edition”的程序。 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.为了截屏,我尝试按下 F12 键来触发 Steam 截屏。 Here's a couple of examples of what I tried:这是我尝试过的几个示例:

keybd_event(VK_F12, 0, 0, 0);
Sleep(250);
keybd_event(VK_F12, 0, KEYEVENTF_KEYUP, 0);

This second example confirmed that the keypress is being registered, but no screenshots are being taken.第二个示例确认正在注册按键,但没有截取屏幕截图。

INPUT input[1] = {};
input[0].type = INPUT_KEYBOARD;
input[0].ki.wVk = VK_F12;
UINT test = SendInput(ARRAYSIZE(input), input, sizeof(INPUT));
std::cout << test;

If anyone has any ideas on how to get this to work, or other ways to take a screenshot, please let me know!如果有人对如何使其工作或其他截屏方式有任何想法,请告诉我!

Kindly check the version maybe by this the problem is solved.请检查版本也许通过这个问题解决了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM