Code:
LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
COLORREF In = RGB(0,0,255);
COLORREF Out = RGB(255,0,0);
COLORREF Map[45] = {Out, Out, Out, Out, Out, Out, Out, Out, Out,
In, Out, Out,Out, Out, Out, Out, Out, In,
In, In, Out, Out, Out, Out, Out, In, In,
In, In, In, Out, Out, Out, In, In, In,
In, In, In, In, Out, In, In, In, In,
};
switch (message)
{
case WM_PAINT:
{
HDC hdc1, hdc2;
HBITMAP hBmp;
BITMAPINFO bi;
PAINTSTRUCT ps;
hdc1 = CreateCompatibleDC(hdc2 = GetDC(0));
ZeroMemory(&bi.bmiHeader,sizeof(bi.bmiHeader));
bi.bmiHeader.biSize = sizeof(bi.bmiHeader);
bi.bmiHeader.biWidth = 9;
bi.bmiHeader.biHeight = 5;
bi.bmiHeader.biPlanes = 1;
bi.bmiHeader.biBitCount = 32;
bi.bmiHeader.biCompression = BI_RGB;
bi.bmiHeader.biSizeImage = bi.bmiHeader.biWidth * bi.bmiHeader.biHeight * (bi.bmiHeader.biBitCount/8);
bi.bmiHeader.biXPelsPerMeter = bi.bmiHeader.biYPelsPerMeter = 0;
hBmp = CreateDIBitmap(hdc2, &bi.bmiHeader, CBM_INIT, Map, &bi, DIB_RGB_COLORS);
SelectObject(hdc1, hBmp);
if(BeginPaint(hwnd,&ps))
{
BitBlt(ps.hdc,25,25,9,5,hdc1,0,0,SRCCOPY);
EndPaint(hwnd,&ps);
}
DeleteDC(hdc1);
}break;
case WM_DESTROY:
PostQuitMessage (0);
break;
default:
return DefWindowProc (hwnd, message, wParam, lParam);
}
return 0;
}