Ownerdraw buttons (again, I know)
I'm having some trouble. No, that's an understatment, I have no clue what I'm doing.
I haven't worked much with bitmap, but I want to make some ownerdraw buttons. When the user presses a button, the image should change for the time of the mousebutton down. But that's for later, I can't even get the image on the button :(
As I understand it, you have to create the button and load the bitmap durng the WM_CREATE and draw it during the WM_DRAWITEM.
her's my code:
Am I forgetting something? Or did I make some huge error here (or possebly more then one) :confused:
#define BUTTON1 40
static HBITMAP hbitmap;
static BITMAP bm;
static HWND hbutton;
hbitmap=(HBITMAP) LoadImage(hinstance, "play.bmp", IMAGE_BITMAP,SM_CXICON,SM_CYICON,LR_LOADFROMFILE);
GetObject(hbitmap, sizeof(bm), &bm);//don't know if I need this
hbutton=CreateWindow( "button",NULL, WS_CHILD | WS_VISIBLE | BS_OWNERDRAW,
210, 350, 100,100, hwnd, (HMENU)BUTTON1, hinstance, 0 );
case WM_DRAWITEM :
SendMessage(hbutton, BM_SETIMAGE, (WPARAM)IMAGE_BITMAP, (LPARAM)hbitmap);