当前位置: 代码迷 >> VC/MFC >> 抓图时,如何连鼠标图形一起抓出来
  详细解决方案

抓图时,如何连鼠标图形一起抓出来

热度:126   发布时间:2016-05-02 03:39:54.0
抓图时,怎么连鼠标图形一起抓出来?
抓图时,怎么连鼠标图形一起抓出来?

谢谢。
------解决思路----------------------
1. GetMouse
// We try to get the cursor's icon
HCURSOR CScreenRecordDlg::GetMouse(LPPOINT pt)
{// 
HCURSOR tmp=0;
CWnd *pwin=WindowFromPoint(*pt);
DWORD TidOrig=GetWindowThreadProcessId(pwin->m_hWnd,0);
DWORD Tid=GetCurrentThreadId();
if(TidOrig==Tid)
{// if same threads ;then use current
tmp=GetCursor();
}
else if(AttachThreadInput(Tid,TidOrig,TRUE))
{// if different threads; use the orignal 
tmp=GetCursor();
 // we have to detach
AttachThreadInput(Tid,TidOrig,FALSE);
}
return tmp;
}
2. how to use
// draw cursor
if(m_bHasMouse)
{
POINT pt;
GetCursorPos(&pt);//get position
HCURSOR hicon=GetMouse(&pt);
ICONINFO iconinfo;
ZeroMemory(&iconinfo,sizeof(ICONINFO));
GetIconInfo(hicon,&iconinfo);//need Hotspot
DrawIcon(hMemDC, pt.x-iconinfo.xHotspot, pt.y-iconinfo.yHotspot, hicon);
}

------解决思路----------------------
“ScreenRecord.zip”
http://download.csdn.net/detail/schlafenhamster/4022912
“ScreenRecord.zip 用于录制屏幕成AVI文件,使用CRAM 或 mRLE8压缩。 8位或32位位图。”
  相关解决方案