TRACKMOUSEEVENT für Fenster+Controls gleichzeitig



  • Hallo,

    wie der Titel schon aussagt, wie kann das Hauptfenster + die darin enthaltenen Controls abfangen, sprich das das für das ganze Fenster gilt, auch wenn ich mit der Maus über einem Control bin (wo nämlich WM_MOUSELEAVE / WM_MOUSEHOVER ans Fenster geworfen werden). Hier mal der Source dazu was ich schon hab:

    case WM_INITDIALOG:
    		{
    
    			inWindow = FALSE;
    			alpha = 1;
    
    			RECT rect;
    			SystemParametersInfo(SPI_GETWORKAREA, 0, &rect, 0);
    			MoveWindow(hwnd, rect.right - 200, 0, 200, rect.bottom - rect.top, TRUE);
    			hwndLV = CreateWindowEx(NULL, WC_LISTVIEW, "", WS_CHILD | LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP | WS_VISIBLE, 5, 5, 190, rect.bottom - rect.top - 10, hwnd, (HMENU)100001, GetModuleHandle(NULL), NULL);
    
    			LVCOLUMN lvColumn;
    			int col = 0;
    			lvColumn.mask = LVCF_TEXT | LVCF_WIDTH;
    
    			lvColumn.cx = 190;
    			lvColumn.pszText = "Path";
    			ListView_InsertColumn(hwndLV, col, &lvColumn);
    
    			SetTimer(hwnd, TIMER1, 5, NULL);
    			return TRUE;
    		}
    case WM_MOUSEMOVE:
    		{
    			if(!inWindow)
    			{
    				inWindow = TRUE;
    				TRACKMOUSEEVENT tme;
    				tme.cbSize = sizeof(TRACKMOUSEEVENT);
    				tme.dwFlags = TME_HOVER | TME_LEAVE; //<-- gilt ja nur fürs Fenster ohne Controls :(
    				tme.hwndTrack = hwnd;
    				tme.dwHoverTime = 1;
    				TrackMouseEvent(&tme);
    				return FALSE;
    			}
    			return TRUE;
    		}
    		case WM_MOUSELEAVE:
    		{
    			if(inWindow)
    			{
    				inWindow = FALSE;
    				KillTimer(hwnd, TIMER1);
    				SetTimer(hwnd, TIMER3, 1000, NULL);
    				return FALSE;
    			}
    			return TRUE;
    		}
    		case WM_MOUSEHOVER:
    		{
    			if(inWindow)
    			{
    				inWindow = TRUE;
    				KillTimer(hwnd, TIMER2);
    				SetTimer(hwnd, TIMER1, 5, NULL);
    
    				RECT rect;
    				SystemParametersInfo(SPI_GETWORKAREA, 0, &rect, 0);
    				MoveWindow(hwnd, rect.right - 200, 0, 200, rect.bottom - rect.top, TRUE);		
    				return FALSE;
    			}
    			return TRUE;
    		}
    

Anmelden zum Antworten