C语言运行出全屏的的图像怎样截取?

来源:百度知道 编辑:UC知道 时间:2024/06/07 07:02:33
我用C语言运行出一个全屏的的图像 想要截取这个图像应该怎么作 有什么好用的软件或其他什么方法吗 (印屏幕不好用,按Alt+Enter TC不能变小)

MS VC++ 的 c 程序可以实现。
方法:
(1)用键盘按键程序模拟法,把图像发送到clipboard
(2)把clipboard图像存入.bmp 图像文件(或别的格式)。

编译:
cl simu_keyboard.c user32.lib Gdi32.lib
特殊头文件:
#include <Windows.h>
#include <Winuser.h>
#include <memory.h>

提示:
(1)按键程序模拟子程序:
void snapscreen_2_clipboard()
{
keybd_event(VK_SNAPSHOT,0x2C,0,0);
keybd_event(VK_SNAPSHOT,0x2C,KEYEVENTF_KEYUP,0);
}
(2)clipboard图像存入.bmp 图像文件
FILE *fout;
/* --------------------------------------------------------------
* dib
int GetBytesPerPixel(int depth);
int GetBytesPerRow(int width, int depth);
int GetBitmapBytes(int width, int height, int depth);
* --------------------------------------------------------------*/
int GetBytesPerPixel(int depth)
{ return (depth==32 ? 4 : 3);
}

int GetBytesPerRow(int width, int depth)
{
int bytesPerPixel = GetBytesPerPixel(depth);
int