winapibitmapbitblt

Unexpected Bitmap Size Drawn by BitBlt and CreateBitmap


I managed to extract the raw bytes of the bitmap used by the cursor of another application. It should be a 32x32 pixel 32bit color bitmap i.e. (24bit RGB + 8bit alpha). There are 4096 bytes which exactly corresponds to 4bytes per pixel (32*32=1024 pixels). To verify the raw bytes are correct, I tried to display the bytes as bitmap again to see what is displayed.

To my surprise, the result is a bitmap of size > 32x32 pixels. The appearance of the bitmap is definitely correct. But I am wondering why an oversized bitmap could ever be produced. I have only 4096 raw bytes. Shouldn't the displayed bitmap be 32x32 pixels only?

Here is my complete win32 test code (compilable in VC++2019)

#include <windows.h>
#include <stdio.h>
#include <io.h>
#include <fcntl.h>
#include <tchar.h>
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
#define ID_TIMER 1
#define ID_BUTTON    1

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
    PSTR szCmdLine, int iCmdShow)
{
    static TCHAR szAppName[] = TEXT("BitBlt");
    HWND         hwnd;
    MSG          msg;
    WNDCLASS     wndclass;

    wndclass.style = CS_HREDRAW | CS_VREDRAW;
    wndclass.lpfnWndProc = WndProc;
    wndclass.cbClsExtra = 0;
    wndclass.cbWndExtra = 0;
    wndclass.hInstance = hInstance;
    wndclass.hIcon = LoadIcon(NULL, IDI_INFORMATION);
    wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
    wndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
    wndclass.lpszMenuName = NULL;
    wndclass.lpszClassName = szAppName;

    if (!RegisterClass(&wndclass))
    {
        MessageBox(NULL, TEXT("This program requires Windows NT!"),
            szAppName, MB_ICONERROR);
        return 0;
    }

    hwnd = CreateWindow(szAppName, TEXT("BitBlt Demo"),
        WS_OVERLAPPEDWINDOW,
        CW_USEDEFAULT, CW_USEDEFAULT,
        CW_USEDEFAULT, CW_USEDEFAULT,
        NULL, NULL, hInstance, NULL);

    ShowWindow(hwnd, iCmdShow);
    UpdateWindow(hwnd);

    while (GetMessage(&msg, NULL, 0, 0))
    {
        TranslateMessage(&msg);
        DispatchMessage(&msg);
    }
    return msg.wParam;
}
unsigned char bitmap[] = {
 0x4e,0x54,0x50,0xff,0x5e,0x62,0x5c,0xff,0x10,0x0f,0x0e,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x2b,0x2c,0x2a,0xff,0x9c,0x99,0x8c,0xff,0x94,0x9a,0x92,0xff,0x47,0x4c,0x49,0xff
,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x17,0x1a,0x17,0xff
,0x1e,0x21,0x1f,0xff,0x1e,0x21,0x1f,0xff,0x02,0x03,0x08,0xff,0x02,0x03,0x08,0xff
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x06,0x08,0x06,0xff,0x37,0x32,0x1d,0xff,0x95,0x91,0x77,0xff,0x9b,0x9c,0x93,0xff
,0x4b,0x51,0x4b,0xff,0x5b,0x5d,0x5a,0xff,0x0d,0x16,0x1a,0xff,0x22,0x24,0x22,0xff
,0x5e,0x62,0x5c,0xff,0x53,0x59,0x55,0xff,0x82,0x85,0x81,0xff,0x9c,0xa1,0x9b,0xff
,0x2c,0x32,0x32,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x0a,0x09,0x04,0xff,0x28,0x23,0x0e,0xff,0x3d,0x3a,0x25,0xff
,0xb1,0xb0,0xaa,0xff,0xf7,0xf7,0xf8,0xff,0xa9,0xb1,0xb1,0xff,0x27,0x36,0x3e,0xff
,0x05,0x0a,0x0c,0xff,0x1d,0x21,0x22,0xff,0x8c,0x8a,0x82,0xff,0xdb,0xdc,0xdb,0xff
,0x9b,0xa5,0xa4,0xff,0x24,0x2b,0x2b,0xff,0x00,0x00,0x00,0xff,0x34,0x38,0x35,0xff
,0x2c,0x32,0x32,0xff,0x06,0x08,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x2f,0x2a,0x13,0xff
,0x71,0x6b,0x51,0xff,0xc3,0xc5,0xbf,0xff,0xec,0xec,0xed,0xff,0xab,0xb1,0xac,0xff
,0x3d,0x45,0x47,0xff,0x0c,0x11,0x12,0xff,0x4d,0x4c,0x41,0xff,0x6a,0x6b,0x63,0xff
,0x98,0x95,0x8a,0xff,0x83,0x84,0x7b,0xff,0x34,0x38,0x35,0xff,0x28,0x29,0x20,0xff
,0x5e,0x62,0x5c,0xff,0x39,0x3c,0x39,0xff,0x05,0x0a,0x0c,0xff,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0a,0x09,0x04,0xff
,0x3c,0x34,0x15,0xff,0x64,0x5f,0x4d,0xff,0x83,0x84,0x7b,0xff,0x8c,0x8a,0x82,0xff
,0x94,0x9a,0x92,0xff,0x73,0x78,0x6e,0xff,0x46,0x44,0x36,0xff,0x4d,0x4c,0x41,0xff
,0x2b,0x32,0x2e,0xff,0x6c,0x72,0x6b,0xff,0x64,0x6a,0x69,0xff,0x4b,0x51,0x4b,0xff
,0x4e,0x57,0x58,0xff,0x62,0x63,0x60,0xff,0x39,0x3c,0x39,0xff,0x02,0x03,0x08,0xff
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x11,0x0f,0x06,0xff,0x48,0x40,0x25,0xff,0x51,0x51,0x45,0xff,0x53,0x59,0x55,0xff
,0xa3,0xa9,0xa3,0xff,0x75,0x7e,0x79,0xff,0x22,0x24,0x22,0xff,0x5c,0x63,0x62,0xff
,0xa1,0xab,0xad,0xff,0xb4,0xbc,0xbc,0xff,0xa9,0xb1,0xb1,0xff,0x9c,0xa1,0x9b,0xff
,0x8e,0x93,0x89,0xff,0x79,0x7d,0x71,0xff,0x5c,0x61,0x55,0xff,0x2c,0x31,0x27,0xff
,0x02,0x03,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x1e,0x1c,0x0f,0xff,0x44,0x40,0x2c,0xff,0x4b,0x51,0x4b,0xff
,0x2b,0x32,0x2e,0xff,0x47,0x53,0x59,0xff,0x91,0x95,0x94,0xff,0xc2,0xc3,0xc3,0xff
,0xe3,0xe3,0xe3,0xff,0xf7,0xf7,0xf8,0xff,0xf7,0xf7,0xf8,0xff,0xdb,0xdc,0xdb,0xff
,0xa2,0xa4,0xa1,0xff,0x8e,0x93,0x89,0xff,0x8b,0x90,0x85,0xff,0x54,0x59,0x4c,0xff
,0x1a,0x1c,0x1a,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x02,0x03,0x08,0xff,0x07,0x0a,0x12,0xff,0x05,0x0a,0x0c,0xff,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x02,0x03,0x08,0xff,0x13,0x14,0x13,0xff,0x13,0x11,0x0d,0xff
,0x51,0x55,0x52,0xff,0x9b,0x9c,0x93,0xff,0x94,0x8f,0x82,0xff,0xab,0xad,0xaa,0xff
,0xd2,0xd2,0xd2,0xff,0xf7,0xf7,0xf8,0xff,0xfc,0xfc,0xfc,0xff,0xfc,0xfc,0xfc,0xff
,0xcc,0xd0,0xce,0xff,0x94,0x9a,0x92,0xff,0x94,0x9a,0x92,0xff,0x83,0x89,0x7e,0xff
,0x3b,0x41,0x35,0xff,0x06,0x08,0x06,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x02,0x03,0x08,0xff,0x19,0x1f,0x21,0xff,0x24,0x2b,0x2b,0xff,0x08,0x0b,0x10,0xff
,0x00,0x00,0x00,0x00,0x02,0x03,0x08,0x00,0x05,0x0a,0x0c,0xff,0x3b,0x41,0x35,0xff
,0x82,0x7c,0x6b,0xff,0x7f,0x78,0x65,0xff,0x9c,0x99,0x8c,0xff,0xb8,0xb4,0xb2,0xff
,0xab,0xad,0xaa,0xff,0xd2,0xd2,0xd2,0xff,0xfc,0xfc,0xfc,0xff,0xfc,0xfc,0xfc,0xff
,0xd7,0xda,0xd8,0xff,0xab,0xb1,0xac,0xff,0x8e,0x93,0x89,0xff,0x8e,0x93,0x89,0xff
,0x8c,0x8a,0x82,0xff,0x43,0x45,0x3e,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x02,0x03,0x08,0xff,0x1a,0x1c,0x1a,0xff,0x2b,0x32,0x2e,0xff,0x13,0x1b,0x21,0xff
,0x02,0x03,0x08,0xff,0x08,0x0b,0x10,0xff,0x0c,0x11,0x12,0xff,0x3a,0x3b,0x34,0xff
,0x59,0x58,0x4b,0xff,0x6c,0x69,0x5d,0xff,0x98,0x95,0x8a,0xff,0xa0,0x9d,0x93,0xff
,0xb1,0xb0,0xaa,0xff,0xb8,0xb4,0xb2,0xff,0xe3,0xe3,0xe3,0xff,0xbb,0xbc,0xb8,0xff
,0x85,0x80,0x75,0xff,0x94,0x9a,0x92,0xff,0xb3,0xb9,0xb4,0xff,0xa2,0xa3,0x9d,0xff
,0x71,0x73,0x68,0xff,0x31,0x35,0x32,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x24,0x23,0x1b,0xff,0x5c,0x61,0x55,0xff,0x55,0x5b,0x59,0xff
,0x39,0x3e,0x40,0xff,0x13,0x1b,0x21,0xff,0x0d,0x16,0x1a,0xff,0x14,0x1a,0x1b,0xff
,0x3b,0x41,0x35,0xff,0x5c,0x5c,0x52,0xff,0x82,0x7c,0x6b,0xff,0x82,0x7c,0x6b,0xff
,0x98,0x95,0x8a,0xff,0xb2,0xaf,0xab,0xff,0xc3,0xc5,0xbf,0xff,0xbb,0xbb,0xb5,0xff
,0x6a,0x6b,0x63,0xff,0xb3,0xb9,0xb4,0xff,0xbb,0xc0,0xc4,0xff,0x7b,0x83,0x7f,0xff
,0x4b,0x51,0x4b,0xff,0x2b,0x32,0x2e,0xff,0x02,0x03,0x08,0xff,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x0b,0x0b,0x0a,0xff,0x4f,0x53,0x45,0xff,0x5c,0x5c,0x52,0xff
,0x8d,0x8a,0x7c,0xff,0xa2,0xa3,0x9d,0xff,0x53,0x5b,0x60,0xff,0x0d,0x16,0x1a,0xff
,0x0d,0x16,0x1a,0xff,0x46,0x48,0x3e,0xff,0x5c,0x61,0x55,0xff,0xa0,0x9d,0x93,0xff
,0x6a,0x6b,0x63,0xff,0xac,0xaa,0xa3,0xff,0xd8,0xd7,0xd7,0xff,0xcd,0xd0,0xd3,0xff
,0x91,0x9d,0xa8,0xff,0x86,0x97,0xa5,0xff,0x7f,0x8a,0x92,0xff,0x65,0x6e,0x71,0xff
,0x55,0x5b,0x59,0xff,0x63,0x69,0x64,0xff,0x31,0x35,0x32,0xff,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x34,0x32,0x27,0xff,0x54,0x4b,0x3d,0xff
,0x6c,0x63,0x56,0xff,0x83,0x75,0x66,0xff,0xb0,0xab,0xa3,0xff,0x95,0x9b,0x9b,0xff
,0x25,0x2d,0x31,0xff,0x24,0x2b,0x2b,0xff,0x3d,0x41,0x3b,0xff,0x3d,0x41,0x3b,0xff
,0x67,0x68,0x5b,0xff,0xac,0xaa,0xa3,0xff,0x85,0x8b,0x8c,0xff,0x44,0x56,0x65,0xff
,0x6d,0x7e,0x8e,0xff,0xaf,0xb8,0xc2,0xff,0xec,0xec,0xed,0xff,0xf4,0xf4,0xf5,0xff
,0xdd,0xe1,0xe1,0xff,0xb2,0xb4,0xb3,0xff,0x72,0x76,0x70,0xff,0x3d,0x41,0x3b,0xff
,0x13,0x14,0x13,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x08,0x06,0x00,0x24,0x23,0x1b,0xff
,0x54,0x4b,0x3d,0xff,0x67,0x52,0x3f,0xff,0x66,0x53,0x42,0xff,0x92,0x89,0x7c,0xff
,0x8a,0x8d,0x89,0xff,0x24,0x2b,0x2b,0xff,0x24,0x2b,0x2b,0xff,0x4b,0x51,0x4b,0xff
,0x51,0x55,0x52,0xff,0x2c,0x32,0x32,0xff,0x53,0x5b,0x60,0xff,0x9a,0x9c,0x9b,0xff
,0xac,0xaa,0xa3,0xff,0xd1,0xcd,0xd1,0xff,0xfc,0xfc,0xfc,0xff,0xfc,0xfc,0xfc,0xff
,0xcd,0xce,0xd0,0xff,0x95,0x9b,0x9b,0xff,0x6c,0x72,0x6b,0xff,0x5c,0x63,0x62,0xff
,0x53,0x59,0x55,0xff,0x39,0x3c,0x39,0xff,0x1a,0x1c,0x1a,0xff,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x1c,0x1b,0x15,0xff,0x4b,0x40,0x31,0xff,0x62,0x4b,0x38,0xff,0x6c,0x57,0x43,0xff
,0x82,0x7c,0x6b,0xff,0x62,0x63,0x60,0xff,0x13,0x1b,0x21,0xff,0x14,0x21,0x28,0xff
,0x0d,0x16,0x1a,0xff,0x44,0x49,0x43,0xff,0x9c,0x99,0x8c,0xff,0x9c,0x94,0x84,0xff
,0xb2,0xaf,0xab,0xff,0xb2,0xb4,0xb3,0xff,0xa2,0xa4,0xa1,0xff,0xa1,0xab,0xad,0xff
,0xb4,0xbc,0xbc,0xff,0xbb,0xc0,0xc4,0xff,0xa9,0xb1,0xb1,0xff,0x94,0x9a,0x92,0xff
,0x82,0x85,0x81,0xff,0x6c,0x72,0x6b,0xff,0x4b,0x51,0x4b,0xff,0x1a,0x1c,0x1a,0xff
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x0b,0x0b,0x0a,0xff,0x33,0x2c,0x21,0xff,0x49,0x3d,0x2f,0xff
,0x59,0x4d,0x3e,0xff,0x83,0x75,0x66,0xff,0x1e,0x23,0x28,0xff,0x13,0x1b,0x21,0xff
,0x1d,0x21,0x22,0xff,0x5c,0x5c,0x52,0xff,0x74,0x70,0x63,0xff,0x8d,0x8a,0x7c,0xff
,0x7b,0x79,0x6d,0xff,0x7f,0x8a,0x92,0xff,0xae,0xb5,0xba,0xff,0xde,0xde,0xe1,0xff
,0xfc,0xfc,0xfc,0xff,0xfc,0xfc,0xfc,0xff,0xec,0xec,0xed,0xff,0xd2,0xd2,0xd2,0xff
,0xab,0xad,0xaa,0xff,0x8b,0x90,0x85,0xff,0x71,0x73,0x68,0xff,0x44,0x49,0x43,0xff
,0x13,0x14,0x13,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0a,0x0c,0xff,0x28,0x29,0x20,0xff
,0x34,0x32,0x27,0xff,0x49,0x3d,0x2f,0xff,0x22,0x24,0x22,0xff,0x14,0x1a,0x1b,0xff
,0x1d,0x21,0x22,0xff,0x4d,0x4c,0x41,0xff,0x56,0x4f,0x48,0xff,0x5c,0x5c,0x52,0xff
,0x81,0x87,0x8a,0xff,0xbb,0xc0,0xc4,0xff,0xb8,0xb4,0xb2,0xff,0xc7,0xc4,0xc8,0xff
,0xf4,0xf4,0xf5,0xff,0xfc,0xfc,0xfc,0xff,0xf7,0xf7,0xf8,0xff,0xca,0xcf,0xcb,0xff
,0xb2,0xb4,0xb3,0xff,0x9c,0xa1,0x9b,0xff,0x83,0x89,0x7e,0xff,0x5c,0x61,0x55,0xff
,0x1a,0x1c,0x1a,0xff,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x03,0x08,0xff
,0x02,0x03,0x08,0xff,0x00,0x00,0x00,0xff,0x02,0x03,0x08,0xff,0x02,0x03,0x08,0xff
,0x13,0x11,0x0d,0xff,0x49,0x3d,0x2f,0xff,0x59,0x4d,0x4e,0xff,0x7a,0x75,0x72,0xff
,0xa5,0xa0,0x94,0xff,0x9c,0x94,0x84,0xff,0xac,0xaa,0xa3,0xff,0xbd,0xbd,0xc2,0xff
,0xcd,0xce,0xd0,0xff,0xf7,0xf7,0xf8,0xff,0xec,0xec,0xed,0xff,0xd1,0xd2,0xce,0xff
,0xc5,0xca,0xc7,0xff,0xbd,0xc4,0xbd,0xff,0x94,0x9a,0x92,0xff,0x5c,0x5c,0x52,0xff
,0x1c,0x1b,0x15,0xff,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x11,0x0f,0x06,0xff,0x48,0x3a,0x37,0xff,0x6b,0x5f,0x5b,0xff,0x88,0x82,0x74,0xff
,0x88,0x82,0x74,0xff,0x9c,0x94,0x84,0xff,0x9c,0x94,0x84,0xff,0xb2,0xaf,0xab,0xff
,0xc2,0xc3,0xc3,0xff,0xdb,0xdc,0xdb,0xff,0xf7,0xf7,0xf8,0xff,0xea,0xea,0xe5,0xff
,0xc5,0xca,0xc7,0xff,0x93,0xa3,0xb3,0xff,0x51,0x63,0x71,0xff,0x24,0x2b,0x2b,0xff
,0x06,0x08,0x06,0xff,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x18,0x16,0x0c,0xff,0x4d,0x3b,0x3a,0xff,0x69,0x57,0x54,0xff,0x6b,0x64,0x58,0xff
,0x74,0x70,0x63,0xff,0x88,0x82,0x74,0xff,0x98,0x95,0x8a,0xff,0xa0,0x9d,0x93,0xff
,0xcb,0xc8,0xc5,0xff,0xe3,0xe3,0xe3,0xff,0xa2,0xa7,0xaa,0xff,0x52,0x67,0x94,0xff
,0x30,0x54,0x8a,0xff,0x23,0x40,0x66,0xff,0x1a,0x29,0x37,0xff,0x0c,0x11,0x12,0xff
,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x11,0x0f,0x06,0xff,0x38,0x2d,0x2a,0xff,0x5c,0x44,0x43,0xff,0x65,0x55,0x4e,0xff
,0x70,0x6b,0x5e,0xff,0x81,0x7f,0x72,0xff,0x8d,0x8a,0x7c,0xff,0x98,0x95,0x8a,0xff
,0x95,0x9b,0x9b,0xff,0x50,0x67,0x82,0xff,0x14,0x38,0x93,0xff,0x1b,0x3b,0x89,0xff
,0x22,0x2e,0x3e,0xff,0x17,0x1a,0x17,0xff,0x10,0x0f,0x0e,0xff,0x02,0x03,0x08,0xff
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x24,0x23,0x1b,0xff,0x50,0x3a,0x3b,0xff,0x5c,0x44,0x43,0xff
,0x6c,0x63,0x56,0xff,0x70,0x6b,0x5e,0xff,0x62,0x63,0x60,0xff,0x4a,0x58,0x6a,0xff
,0x26,0x47,0x70,0xff,0x23,0x40,0x66,0xff,0x21,0x2d,0x41,0xff,0x17,0x1a,0x17,0xff
,0x13,0x11,0x0d,0xff,0x0b,0x0b,0x0a,0xff,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x20,0x1e,0x14,0xff,0x40,0x2f,0x31,0xff,0x55,0x39,0x40,0xff
,0x45,0x37,0x33,0xff,0x39,0x3c,0x39,0xff,0x2a,0x37,0x42,0xff,0x22,0x36,0x49,0xff
,0x1f,0x27,0x31,0xff,0x17,0x1a,0x17,0xff,0x13,0x11,0x0d,0xff,0x10,0x0f,0x0e,0xff
,0x06,0x08,0x06,0xff,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x13,0x14,0x13,0xff,0x20,0x1d,0x1e,0xff,0x2b,0x2c,0x2a,0xff
,0x24,0x2b,0x2b,0xff,0x24,0x2b,0x2b,0xff,0x1d,0x21,0x22,0xff,0x13,0x14,0x13,0xff
,0x0b,0x0b,0x0a,0xff,0x06,0x08,0x06,0xff,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0xff
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x0b,0x0b,0x0a,0x00,0x13,0x14,0x13,0xff,0x13,0x14,0x13,0xff
,0x13,0x14,0x13,0xff,0x10,0x0f,0x0e,0xff,0x0b,0x0b,0x0a,0xff,0x06,0x08,0x06,0xff
,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0xff
,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00

}
;


LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    HDC         hdcClient, hdcWindow;

    int         x, y;
    PAINTSTRUCT ps;

    switch (message)
    {

    case WM_PAINT:
    {
        //InvalidateRect(hwnd, NULL, TRUE);
        hdcClient = BeginPaint(hwnd, &ps);
        HBITMAP hbitmap = CreateBitmap(32, 32, 1, 32, bitmap);
        HDC hdcMem = CreateCompatibleDC(NULL);
        SelectObject(hdcMem, hbitmap);
        BitBlt(hdcClient, 0, 80, 32, 32, hdcMem, 0, 0, SRCCOPY);

    
        EndPaint(hwnd, &ps);
        return 0;
    }
    case WM_DESTROY:
        PostQuitMessage(0);
        return 0;
    }
    return DefWindowProc(hwnd, message, wParam, lParam);
}

The data bytes are embedded in the code, the size of the array should be 256*16=4096 bytes (256 lines, 16 bytes each line). I managed to display an image in my window. I pressed print screen and pasted the picture to mspaint.exe. I then enlarged the image to 800% in mspaint and examined the size of the image. At this resolution each pixel can be seen clearly. I can see an image whose size is greater than 32x32 pixels:

enter image description here

It looks like an image of 40x40 pixels. How is it possible my 4096 bytes produced more pixels then it should be. I am new to bitmap processing and win32. Are there anything I misunderstood?


Solution

  • Problem solved by adding this line to winMain() to prevent auto scaling:

    SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2);