Changing Bitmaps Drawn Over An Ownerdraw Push Button On/Off On Mouse Hover..
Posted on 2004-04-06
Here comes the same stuff again.. no dialog-box nothing, just a main window, ghwndApp, created with CreateWindowEx(......), on the top of it one command button created like,
HWND hwndcommand1=CreateWindow("BUTTON",NULL,WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON | BS_PUSHBUTTON | BS_BITMAP | BS_OWNERDRAW | BS_FLAT,600,320,169,48,ghwndApp,NULL,(HINSTANCE)GetWindowLong(ghwndApp,GWL_HINSTANCE),NULL);
It's a Ownerdraw, bitmap button, I used WM_DRAWITEM Message To Paint the Button with the HBITMAP bitmap1 (already loaded).
All works fine.
Now what I want more is to change the bitmap over the button to a different picture (that bitmap also loaded) when the mouse is over the button and back to the old bitmap when the mouse is not.
For that I guess, I have to _TrackMouseEvent() for this command button window, hwndcommand1
I did the same just after creating the button as::
track1.dwFlags=TME_HOVER | TME_QUERY;
But I am not getting any sort of WM_MOUSEHOVER, when I move mouse over this button.
How can we achieve this kind of stuff, please show some guidelines. To change bitmaps over a button, one while normal and one while the mouse is over it.