Posted on 2012-10-16 09:45
盛胜 阅读(489)
评论(0) 编辑 收藏 引用
来源:http://topic.csdn.net/u/20080228/14/8a514245-266e-4c58-9626-4ddeb52f0d97.html
1.截屏
2.建立一个无边框的窗口,填充整个屏幕
3.将截屏内容贴到窗口中
4.处理鼠标键盘消息即可
BOOL BitBlt(
HDC hdcDest, // handle to destination DC
int nXDest, // x-coord of destination upper-left corner
int nYDest, // y-coord of destination upper-left corner
int nWidth, // width of destination rectangle
int nHeight, // height of destination rectangle
HDC hdcSrc, // handle to source DC
int nXSrc, // x-coordinate of source upper-left corner
int nYSrc, // y-coordinate of source upper-left corner
DWORD dwRop // raster operation code
);
这个函数截取一个矩形很方便
无非就是处理鼠标按下和弹起消息,记录下矩形框,调用BitBlt即可,当然效果好点还要动态绘制鼠标选中的矩形区域
提示:
HDC hDCForm, hdcScreen,hdcCompatible;
HBITMAP hbmScreen;
hDCForm=GetDC(Form1->Handle);
hdcScreen = CreateDC("DISPLAY", NULL, NULL, NULL);
hdcCompatible = CreateCompatibleDC(hdcScreen);
hbmScreen = CreateCompatibleBitmap(hdcScreen,
GetDeviceCaps(hdcScreen, HORZRES),
GetDeviceCaps(hdcScreen, VERTRES));
if(!SelectObject(hdcCompatible, hbmScreen))
{
ShowMessage("erro!");
}
BitBlt(hdcCompatible,
0,0,
800, 600,
hdcScreen,
0,0,
SRCCOPY);