小编Orr*_*ren的帖子

截取屏幕截图

即时尝试使用此代码:

bool SaveBMPFile(char *filename, HBITMAP bitmap, HDC bitmapDC, int width, int height);

bool ScreenCapture(int x, int y, int width, int height, char *filename){
// get a DC compat. w/ the screen
HDC hDc = CreateCompatibleDC(0);

// make a bmp in memory to store the capture in
HBITMAP hBmp = CreateCompatibleBitmap(GetDC(0), width, height);

// join em up
SelectObject(hDc, hBmp);

// copy from the screen to my bitmap
BitBlt(hDc, 0, 0, width, height, GetDC(0), x, y, SRCCOPY);

// save my bitmap
bool …
Run Code Online (Sandbox Code Playgroud)

c screenshot image screen

3
推荐指数
1
解决办法
365
查看次数

标签 统计

c ×1

image ×1

screen ×1

screenshot ×1