|
-
Mar 9th, 2001, 11:04 AM
#1
Thread Starter
Frenzied Member
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:
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;
}
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.
If you dont know what the hdc of the button is you can use
PHP Code:
HDC hdc;
hdc = GetDC(hwndOfTheButton);
MSVS 6, .NET & .NET 2003 Pro
I HATE MSDN with .NET & .NET 2003!!!
Check out my sites:
http://www.filthyhands.com
http://www.techno-coding.com

-
Mar 9th, 2001, 03:34 PM
#2
Hyperactive Member
didn't work
first you forgot the : after each case. second it doesn't seem to catch when the leftmousdown or mouseup. i even tried just making it popup a msgbox when it was clicked rather than setting the pic. that didn't work either. my button is WS_CHILD. it doesn't work. i got the picture to be painted on my button but like i said it won't catch the mouse events. what could be wrong ? if u would like i'll send u the code. but i'm not a beginner. well i am to bitblt. but not to c++ win32.
-
Mar 9th, 2001, 03:36 PM
#3
Thread Starter
Frenzied Member
Yeah I wrote that hole thing from memory so I have no doubt that I would forget something like the :. That would be fine with me. [email protected]
MSVS 6, .NET & .NET 2003 Pro
I HATE MSDN with .NET & .NET 2003!!!
Check out my sites:
http://www.filthyhands.com
http://www.techno-coding.com

Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|