我需要创建 HBITMAP。
问题就在这里。我在内存中有 bmp 文件的内容。
如果位图作为资源,我知道如何创建 HBITMAP。但由于它在内存中,我不知道该怎么做。
我这样做(如果在资源中):链接
hDC = BeginPaint(hWnd, &Ps);
// Load the bitmap from the resource
bmpExercising = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_EXERCISING));
// Create a memory device compatible with the above DC variable
MemDCExercising = CreateCompatibleDC(hDC);
// Select the new bitmap
SelectObject(MemDCExercising, bmpExercising);
// Copy the bits from the memory DC into the current dc
BitBlt(hDC, 10, 10, 450, 400, MemDCExercising, 0, 0, SRCCOPY);
// Restore the old bitmap
DeleteDC(MemDCExercising);
DeleteObject(bmpExercising);
EndPaint(hWnd, &Ps);
如果它是内存资源,请指导我如何操作。不知何故char img[10000]
变成了资源?这里,img
是限制位图内容的内存。