The static HPALETTE HPALETTE.
Int I;
HDC HDC.
HDC=GetDC (HWND);
PLP=(LOGPALETTE *) malloc (sizeof (LOGPALETTE) + 33 * sizeof (PALETTEENTRY));
PLP - & gt; PalVersion=GetDeviceCaps (HDC, DRIVERVERSION);//0 x0300;
PLP - & gt; PalNumEntries=34;//GetDeviceCaps (HDC, NUMFONTS);//34;
For (I=0; i <34. I++)
{
PLP - & gt; PalPalEntry [I] peRed=255;
PLP - & gt; PalPalEntry [I] peGreen=(I==0? 0-255);
PLP - & gt; PalPalEntry [I] peBlue=(I==0? 0-255);
PLP - & gt; PalPalEntry [I] peFlags=(I==33? 0: PC_RESERVED);
}
HPalette=CreatePalette (PLP);
What's the reason why hPalette has been empty? Why create failure?
CodePudding user response:
If (GetDeviceCaps (HDC, RASTERCAPS) & amp; RC_PALETTE)...CodePudding user response: