rendered paste bodyHBITMAP CreateBitmapFromPixel(HDC hDC, UINT uWidth, UINT uHeight, UINT uBitsPerPixel, LPVOID pBits) { HBITMAP hBitmap = 0; if (!uWidth || !uHeight || !uBitsPerPixel) return hBitmap; LONG lBmpSize = uWidth * uHeight * (uBitsPerPixel/8); BITMAPINFO bmpInfo = {0}; bmpInfo.bmiHeader.biBitCount = uBitsPerPixel; bmpInfo.bmiHeader.biHeight = uHeight; bmpInfo.bmiHeader.biWidth = uWidth; bmpInfo.bmiHeader.biPlanes = 1; bmpInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); // Pointer to access the pixels of bitmap UINT *pPixels = 0; hBitmap = CreateDIBSection(hDC, (BITMAPINFO *)&bmpInfo, DIB_RGB_COLORS, (void **)&pPixels, NULL, 0); if (!hBitmap) return hBitmap; SetBitmapBits(hBitmap, lBmpSize, pBits); //memmove(pPixels, pBits, lBmpSize); return hBitmap;}