其他分享
首页 > 其他分享> > WinCE复制HBITMAP

WinCE复制HBITMAP

作者:互联网

HBITMAP CopyBitmap(HBITMAP hbitmap)
{
 BITMAP bmInfo;
 HDC hdc = ::GetDC(m_hWnd);
 HDC hdcsrc = CreateCompatibleDC(hdc);
 HDC hdcdst = CreateCompatibleDC(hdc);
 ::GetObject(hbitmap,sizeof(bmInfo),&bmInfo);
 HBITMAP hbmret = CreateCompatibleBitmap(hdc, bmInfo.bmWidth, bmInfo.bmHeight);
 HBITMAP hbmsrc = (HBITMAP)SelectObject(hdcsrc, hbitmap);
 HBITMAP hbmdst = (HBITMAP)SelectObject(hdcdst, hbmret);
 BitBlt(hdcdst,0,0,bmInfo.bmWidth,bmInfo.bmHeight,hdcsrc,0,0,SRCCOPY);
 SelectObject(hdcdst, hbmdst);
 SelectObject(hdcsrc, hbmsrc);
 DeleteDC(hdcdst);
 DeleteDC(hdcsrc);
 ReleaseDC(m_hWnd,hdc);
 return hbmret;
}

 

标签:hdcdst,bmInfo,SelectObject,复制,hdc,hdcsrc,HBITMAP,WinCE
来源: https://blog.51cto.com/u_15298588/3034331