Ok, this is my code:
Code:
LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
static BOOL bLeave;
switch (uMsg)
{
case WM_CREATE:
{
return 0;
}
case WM_COMMAND:
{
return 0;
}
case WM_CLOSE:
{
DestroyWindow(hWnd);
return 0;
}
case WM_MOUSEMOVE:
{
TRACKMOUSEEVENT tme;
tme.cbSize = sizeof(TRACKMOUSEEVENT);
tme.dwFlags = TME_LEAVE|TME_HOVER;
tme.dwHoverTime = HOVER_DEFAULT;
tme.hwndTrack = hWnd;
_TrackMouseEvent(&tme); // WindowFromPoint
if (bLeave) {
POINTS pMouse;
char szMouse[24];
pMouse = MAKEPOINTS(lParam);
wsprintf(szMouse, "%i, %i", pMouse.x, pMouse.y);
SetWindowText(hWnd, szMouse); // display the mouse points
}
return 0;
}
case WM_MOUSEHOVER:
{
bLeave = FALSE;
return 0;
}
case WM_MOUSELEAVE:
{
bLeave = TRUE;
return 0;
}
case WM_DESTROY:
{
PostQuitMessage(0);
return 0;
}
}
return DefWindowProc(hWnd, uMsg, wParam, lParam);
}
My idea is that display the points only when the mouse is outside of my window, but instead it showed when is inside, any ideas?