如何实现TestDirector那种SnapShot?(把鼠标拖到某个程序的控件上,即可选中该控件并拍照)

beststone 2007-04-28 10:27:44
如何实现TestDirector那种SnapShot?(把鼠标拖到某个程序的控件上,即可选中该控件并拍照)。
请老大们指点指点。谢谢。
...全文
198 2 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
systemthink 2007-04-30
  • 打赏
  • 举报
回复
学习了!
pomelowu 2007-04-28
  • 打赏
  • 举报
回复
OnMouseMove中
if(nFlags == MK_LBUTTON)
{
ShowWindow(SW_HIDE); //隐藏自身窗口
SetCapture(); //捕捉鼠标
ClientToScreen(&point);
HWND hwndCapture=(HWND)::WindowFromPoint(point); //目标窗口

// 拍照
::GetWindowRect(hwndCapture,&rectCapture);
int nWidth=rectCapture.Width();
int nHeight=rectCapture.Height();
HDC hdcScreen, hMemDC;
HBITMAP hBitmap, hOldBitmap;
hdcScreen = CreateDC("DISPLAY", NULL, NULL, NULL);
hMemDC = CreateCompatibleDC(hdcScreen);
hBitmap = CreateCompatibleBitmap(hdcScreen, nWidth, nHeight);
hOldBitmap =(HBITMAP)SelectObject(hMemDC, hBitmap);
BitBlt(hMemDC, 0, 0, nWidth, nHeight, hdcScreen,rectCapture.left,rectCapture.top,SRCCOPY);
hBitmap =(HBITMAP)SelectObject(hMemDC, hOldBitmap);
DeleteDC(hdcScreen);
DeleteDC(hMemDC);
}

15,980

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 界面
社区管理员
  • 界面
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧