19,469
社区成员
发帖
与我相关
我的任务
分享
if (loadimage(_T("ClockBackchain.png"), &lpData, &nSize, &nHeight, &nWidth, &nPitch))
{
CDC dcMemory;
CBitmap bitmap;
CBitmap *oldbitmap;
if (bitmap.CreateBitmap(nWidth, nHeight, 1, 24, (void *)lpData))
{
dcMemory.CreateCompatibleDC(pDC);
oldbitmap = dcMemory.SelectObject(&bitmap);
pDC->BitBlt(0, 0, nWidth, nHeight, &dcMemory, 0, 0, SRCCOPY);
bitmap.DeleteObject();
dcMemory.SelectObject(oldbitmap);
dcMemory.DeleteDC();
}
CString tmp;
tmp.Format("%d", GetLastError());
AfxMessageBox(tmp);
free(lpData);
}
DWORD nWidth = 32;
DWORD nHeight = 32;
PVOIL pBits = NULL;
BITMAPINFO bi;
bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bi.bmiHeader.biWidth = nWidth;
bi.bmiHeader.biHeight = nHeight;
bi.bmiHeader.biPlanes = 1;
bi.bmiHeader.biBitCount = 32;
bi.bmiHeader.biCompression = BI_RGB;
bi.bmiHeader.biSizeImage = nHeight * nWidth * 4;
CreateDIBSection(NULL, &bi, DIB_RGB_COLORS, &pBits, NULL, NULL);