i'm trying building a BITMAP from memory, but isn't easy :(
//create the button
HandleButton=CreateWindowEx (0,"button", "hello\t\tHI",
WS_CHILD | WS_VISIBLE | BS_TEXT | BS_BOTTOM |BS_BITMAP,
100, 100,500, 200,hwnd, (HMENU)4000,hInstance, 0) ;
//create a dc and bitmap in memory
HDC memoryDC =CreateCompatibleDC(GetDC(hwnd));
HBITMAP bitmap=CreateCompatibleBitmap(GetDC(hwnd),500,200);
SelectObject(memoryDC, bitmap);
//get the icon
HandleIcon=(HICON)LoadImage(hInstance,"C:\\acrobat.ico",IMAGE_ICON,SM_CXICON,SM_CYICON,LR_LOADFROMFILE | LR_DEFAULTCOLOR);
DrawIcon(memoryDC,0,0,HandleIcon);
TextOut(memoryDC,0,0,"hello world",11);
//send the bitmap to button
SendMessage(HandleButton, BM_SETIMAGE, IMAGE_BITMAP,(LPARAM)bitmap );
return 0;
my problem is when i create the HDC and HBITMAP... i'm getting several errors:
error: "jump to case label [-fpermissive]"
error: "crosses initialization of 'HBITMAP__* bitmap'"
error: "crosses initialization of 'HDC__* memoryDC'"
error: "jump to case label [-fpermissive]"
error: "crosses initialization of 'HBITMAP__* bitmap'"
error: "crosses initialization of 'HDC__* memoryDC'"
what i'm doing wrong?