简体   繁体   中英

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).

在此处输入图片说明

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.

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++).

您也可以通过Autohotkey Window Spy找到它。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM