#include #define WIDTH 197 #define HEIGHT 100 #define BITCOUNT 24 LRESULT CALLBACK WindowProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam) { HDC hdc; PAINTSTRUCT ps; static LPBYTE lpPixel; static BITMAPINFO bmpInfo; int x,y,r,g,b,rgb; static int length; switch(uMsg) { case WM_CREATE: //4の倍数に補正 if(WIDTH*(BITCOUNT/8)%4) length=WIDTH*(BITCOUNT/8)+(4-WIDTH*(BITCOUNT/8)%4); else length=WIDTH*(BITCOUNT/8); lpPixel=(LPBYTE)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,length*HEIGHT); //DIBの情報を設定する bmpInfo.bmiHeader.biSize=sizeof(BITMAPINFOHEADER); bmpInfo.bmiHeader.biWidth=WIDTH; bmpInfo.bmiHeader.biHeight=HEIGHT; bmpInfo.bmiHeader.biPlanes=1; bmpInfo.bmiHeader.biBitCount=BITCOUNT; bmpInfo.bmiHeader.biCompression=BI_RGB; //描画 for(y=0;y