Well if you have the button set as a child, then what you could do is catch the WM_LBUTTONDOWN for when the left mouse button is clicked down and WM_LBUTTONUP for when the button is released. So it would be something like this:
You will have to either make your bitmap and DCs global or rewrite your hdc and SelectObject code in each case, because you will not be resending the messages to WM_PAINT.PHP Code:case WM_LBUTTONDOWN //Left Mouse Button Down
{
if(hwnd == ThehwndOfYourButton)
{
BitBlt(hdcofbutton, 0, 0, btnwidth, btnheight, hdcofBitmap, 0, 0, SRCCOPY);
break;
}
default:
break;
}
case WM_LBUTTONUP //Left Mouse Button Up
{
if(hwnd == ThehwndOfYourButton)
{
BitBlt(hdcofbutton, 0, 0, btnwidth, btnheight, hdcofBitmap, 0, 0, SRCCOPY);
break;
}
default:
break;
}
If you dont know what the hdc of the button is you can use
PHP Code:HDC hdc;
hdc = GetDC(hwndOfTheButton);




Reply With Quote