16,548
社区成员




void DebugShowBmp(HBITMAP hBmp)
{
HDC hDC = GetWindowDC(NULL);
if (hDC == NULL)
return;
BITMAP bmp = {0};
GetObject(hBmp, sizeof(BITMAP), &bmp);
HDC hCreate = CreateCompatibleDC(hDC);
if (hCreate != NULL)
{
HGDIOBJ hOld = SelectObject(hCreate, hBmp);
BitBlt(hDC, 0, 0, bmp.bmWidth, bmp.bmHeight, hCreate, 0, 0, SRCCOPY);
SelectObject(hCreate, hOld);
DeleteDC(hCreate);
}
ReleaseDC(NULL, hDC);
}
void DebugShowDC(HDC hDCShow)
{
HDC hDC = GetWindowDC(NULL);
if (hDC == NULL)
return;
BITMAP bmp;
HBITMAP hBmp = CreateCompatibleBitmap(hDCShow, 1, 1);
HBITMAP hShowBmp = (HBITMAP)SelectObject(hDCShow, hBmp);
GetObject(hShowBmp, sizeof(BITMAP), &bmp);
SelectObject(hDCShow, hShowBmp);
DeleteObject(hBmp);
BitBlt(hDC, 0, 0, bmp.bmWidth, bmp.bmHeight, hDCShow, 0, 0, SRCCOPY);
ReleaseDC(NULL, hDC);
}