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;
}

 

上一篇:TCP 拥塞控制


下一篇:使用kbmmw smarthttpservice 简单返回数据库结果