抓图时,怎么连鼠标图形一起抓出来?
谢谢。
------解决思路----------------------
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位位图。”