文件名称:c++实现自动抓图的源码
文件大小:3KB
文件格式:CPP
更新时间:2013-05-01 21:44:54
抓图
初学c++,总算弄出来了 #include "stdafx.h" int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { char BitmapNameOut[] = "b.bmp"; /*HDC hdc; hdc = CreateDC("display",NULL,NULL,NULL); HBITMAP hBitmap; char BitmapNameIn[] = "a.bmp"; hBitmap = LoadBitmap(hInstance, BitmapNameIn); //加载一个已有位图*/ //得到一个DDB资源 HDC hdc = GetDC(NULL); HBITMAP hBitmap = CreateCompatibleBitmap(hdc, 100, 100); HDC hdcMem = CreateCompatibleDC(hdc); SelectObject(hdcMem, hBitmap); BitBlt(hdcMem, 0, 0, 100, 100, hdc, 0, 0, SRCCOPY); ...