I am trying to make a mouse hoverbutton, API style
- - when mouse is NOT over the button, it stays as it's default image
- when mouse is over the button, it changes to "mouse over image"
- when mouse leaves the button, it changes back to it's default image
here's what i have done so far:
in my main window proc
Code:
LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
switch(Message)
{
case WM_CREATE:
{
dia_hwnd = CreateDialog(GetModuleHandle(0),MAKEINTRESOURCE(IDD_MENU) ,hwnd,MenuProc);
ShowWindow(dia_hwnd, SW_SHOWNORMAL);
TRACKMOUSEEVENT mouse_event_struct;
mouse_event_struct.cbSize = sizeof(TRACKMOUSEEVENT);
mouse_event_struct.dwFlags = TME_HOVER
mouse_event_struct.hwndTrack =dia_hwnd;
mouse_event_struct.dwHoverTime = 400;
_TrackMouseEvent(&mouse_event_struct);
}
break;
case WM_COMMAND:
switch(LOWORD(wParam))
{ ............
In my MenuProc proc ( for the window dia_hwnd)
Code:
BOOL CALLBACK MenuProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
switch(Message)
{
case WM_INITDIALOG:
{
}
break;
return TRUE;
case WM_MOUSEHOVER:
{
MessageBox(NULL, "mouse left in", "GOOD",
MB_ICONEXCLAMATION | MB_OK);
}
break;
case WM_COMMAND:
switch(LOWORD(wParam))
{........
"mouse left in" message never comes up after i moved my mouse into dia_hwnd window
that means that the code doesnt detect that mouse went into the window. There's something wrong here, please help.
using
- win98se
- vc++6.0
- API style