Search code examples
c++winapieventsonmouseoverpopup-balloons

About WM_MOUSEHOVER, controls and Balloons


I have this code in the switch (msg) loop inside WindowProc on my GUI App.

case WM_MOUSEMOVE:

         TRACKMOUSEEVENT tme;
         tme.cbSize = sizeof(TRACKMOUSEEVENT);
         tme.dwFlags = TME_HOVER;
         tme.dwHoverTime = 100;
         tme.hwndTrack = hwnd;
         TrackMouseEvent(&tme);
    break;
    case WM_MOUSEHOVER:
         DialogBox(hInstance, MAKEINTRESOURCE(IDD_DIALOG), hwnd, AboutDlg);
    break;

I was wondering if I could do anything to have event WM_MOUSEOVER only when I hover over a Control of the window (in this case a CHECKBUTTON)

I need this because I want some explanation about this checkbox (I don't want to write it on the label) to popup when the mouse is over it. I don't want either a DialogBox... is there any Balloon (or something without an OK button) that appears and dissappears instead a dialogbox or messagebox?

Thanks a lot


Solution

  • It's called a tooltip. They often don't require you to track any mouse events at all. You can even make them look like speech balloons. To get started, read about them in MSDN.