【发布时间】:2012-03-20 10:20:12
【问题描述】:
我目前正在尝试创建一个将屏幕的一部分保存到 bmp 的应用程序。我找到了BitBlt,但我真的不知道如何处理它。我已经尝试寻找一些答案,但我仍然没有找到使用 C++ 的澄清答案。
所以,基本上我想要这个功能:
bool capturePartScreen(int x, int y, int w int, h, string dest){
//Capture part of screen according to coordinates, width and height.
//Save that captured image as a bmp to dest.
//Return true if success, false if failure
}
BitBlt:
BOOL BitBlt(
__in HDC hdcDest,
__in int nXDest,
__in int nYDest,
//The three above are the ones I don't understand!
__in int nWidth,
__in int nHeight,
__in HDC hdcSrc,
__in int nXSrc,
__in int nYSrc,
__in DWORD dwRop
);
那个hdc应该是什么,我如何获得bmp?
【问题讨论】:
-
看看这个SO question。
-
看看这个question,它应该会为你指明正确的方向
-
@Jesse:谢谢,那篇文章对我帮助很大:)
-
不是完全重复的,因为问题的关键部分是如何将位图放入文件中。另一个问题根本没有解决这个问题。
-
这根本不是重复的——除了文件保存之外,这个问题询问捕获屏幕的部分,而链接的问题询问捕获整个 屏幕。触发愉快的问题结束很烦人。
标签: c++ winapi bmp screen-capture