Listing 2: Function RenderReset
/* RenderReset creates a master bitmap to match the size of hwnd. */ void RenderReset(HWND hwnd) { HDC hdc = GetDC(hwnd); if(dibSect != NULL) DeleteObject(dibSect); info->bmiHeader.biWidth = (clientSize.right/4L)*4L; info->bmiHeader.biHeight = -clientSize.bottom; if(hp!=NULL) { /* Create a BITMAP optimized for palettes */ SelectPalette(hdc,hp,FALSE); RealizePalette(hdc); dibSect = CreateDIBSection( hdc, info, DIB_PAL_COLORS, &bitmap, NULL,0); } else /* Since there are no palettes do not use DIB_PAL_COLORS */ dibSect = CreateDIBSection( hdc, info, DIB_RGB_COLORS, &bitmap, NULL, 0); ReleaseDC(hwnd,hdc); } /* End of File */