| View previous topic :: View next topic |
| Author |
Message |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Wed Jul 16, 2008 6:22 pm Post subject: message for mouse hovering over a control |
|
|
I'm trying to find a message that's sent, or any API that alerts me when the mouse is hovered over a control. The main reason for this is so that when I make custom GUI applications that don't have a title bar, and I have to add the buttons for that. I want it to be able to change the color of them when they hover over and click on them. But I can't figure out the hover. I found the messages WM_MOUSEHOVER and WM_NCMOUSEHOVER but neither of those were specifically for a control.
_________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
|
|
| Back to top |
|
 |
WafflesFTW Expert Cheater
Reputation: 0
Joined: 21 Mar 2008 Posts: 131
|
Posted: Wed Jul 16, 2008 7:42 pm Post subject: |
|
|
| look at the lparam of WM_MOUSEHOVER
|
|
| Back to top |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Wed Jul 16, 2008 9:08 pm Post subject: |
|
|
What am I supposed to do, make an if statement for each pixel? There has to be another way...
_________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
|
|
| Back to top |
|
 |
Symbol I'm a spammer
Reputation: 0
Joined: 18 Apr 2007 Posts: 5094 Location: Israel.
|
Posted: Wed Jul 16, 2008 9:18 pm Post subject: |
|
|
No, he told you to check the lParam (Hadle to the control) of WM_MOUSEHOVER message.
You could also call ChildWindowFromPoint(Ex) on WM_MOUSEMOVE message.
|
|
| Back to top |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Wed Jul 16, 2008 9:33 pm Post subject: |
|
|
So either...
| Code: |
case WM_MOUSEHOVER:
if(lParam == hExitButton) {
//make brighter to represent hover
}
break;
|
or
| Code: |
case WM_MOUSEHOVER:
POINT point;
point.x = GET_X_LPARAM(lParam);
point.y = GET_Y_LPARAM(lParam);
HWND hwndControl = ChildWindowFromPoint(hWnd, &point);
if(hWndControl == hExitButton) {
//make brighter to represent hover
}
break;
}
|
_________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
|
|
| Back to top |
|
 |
WafflesFTW Expert Cheater
Reputation: 0
Joined: 21 Mar 2008 Posts: 131
|
|
| Back to top |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Thu Jul 17, 2008 8:47 am Post subject: |
|
|
Yea, TrackMouseEvent is used to generate the WM_MOUSEHOVER notification. So I guess it would really be like.
| Code: |
TRACKMOUSEEVENT tme;
tme.cbSize = sizeof(TRACKMOUSEEVENT);
tme.dwFlags = TME_HOVER;
tme.hwndTrack = hWnd;
tme.dwHoverTime = 10;
TrackMouseEvent(&tme);
case WM_HOVER:
if(lParam == hExitButton) {
//brighten to represent hover
}
break;
|
_________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
|
|
| Back to top |
|
 |
|