Search code examples
c++windowswindows-7handletaskbar

How to determine if a window handle is the taskbar thumbnail view?


I have a code that gets the window handle that the mouse cursor is pointing at, and I am required to determine if the mouse cursor points at a window that is not a part of the task bar. My code is able to recognize if I'm pointing at the task bar, the start button and the show desktop button (on windows 7). But I am not able to recognize if I'm pointing on the thumbnails view of combined windows (see image below).

enter image description here

This is the code that I use to recognize the task bar:

    m_hTaskBar = FindWindow("Shell_TrayWnd", "");
    m_hTaskBar = GetAncestor(m_hTaskBar, GA_ROOT);

    // This code is at a mouse move event:
    POINT p;
    GetCursorPos(&p);

    HWND hWnd = GetAncestor(WindowFromPoint(p), GA_ROOT);
    m_hSelectedWin = hWnd;

bool isTaskBar = m_hSelectedWin == m_hTaskBar || GetParent(m_hSelectedWin) == m_hTaskBar;

How can I check if the cursor points at the thumbnails view of combined windows? Thanks.


Solution

  • I have managed to find a solution:

    FindWindow("TaskListThumbnailWnd", "");
    

    I used Spy++ to find the class name of the taskbar thumbnails window.

    Spy++ can be used from Visual Studio (Tools > Spy++).