How to convert an Array of pixels to HBITMAP
问题 I have an array of pixels which I need to convert to HBITMAP in order to display it in a window. I tried to use CreateDIBitmap() but I don't have the BMP headers. I tried to construct them manually according to MSDN documentation but this didn't work. Here how my code looks HBITMAP hBitmap char pixels[160*120]; // White grayscale image of size 160x120 memset(pixels,255,sizeof(pixels)); BITMAPINFOHEADER bmih; bmih.biSize = sizeof(BITMAPINFOHEADER); bmih.biWidth = 160; bmih.biHeight = -120;