troubleshooting Question

Make hover button using Win32 API.

Avatar of jaeb
jaeb asked on
Microsoft Development
6 Comments1 Solution2890 ViewsLast Modified:
I want to bitmap button using win32 api.

So I'm using WM_DRAWITEM.

It works well.

But When mouse is over a button, I want to change button's image.

So I insert below code.

     if (!m_bTracking)
          tme.cbSize = sizeof(tme);
          tme.hwndTrack = GetDlgItem(hwnd, IDOK); <-- something is wrong!
          tme.dwFlags = TME_LEAVE|TME_HOVER;
          tme.dwHoverTime = 1;
          m_bTracking = _TrackMouseEvent(&tme);
     return 0;
        m_bTracking = FALSE;
     MessageBox(NULL, "MouseLeave", "a", MB_OK);
     UpdateWindow(GetDlgItem(hwnd, IDOK));
     return 0;
     MessageBox(NULL, "MouseHover", "a", MB_OK);
     UpdateWindow(GetDlgItem(hwnd, IDOK));
     return 0;

If I execute a program, I can't receive WM_MOUSEHOVER message.

So I modify tme.hwndTrack, tme.hwndTrack = hwnd;(this is dialog's handle)

I can receive WM_MOUSEHOVER...

Why I can't use button's handle at tme.hwndTrack ???

Roshan Davis

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 6 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros