如何检测特定的系统托盘弹出/工具提示

时间:2011-11-21 14:20:20

标签: windows winapi

我需要检测特定的Windows系统托盘工具提示/弹出窗口(USB设备无法识别)。我似乎没有使用FindWindow进行多少运气投票。是否有一个钩子或什么东西会告诉我每一个弹出的?

1 个答案:

答案 0 :(得分:0)

我已经设法执行以下操作:

HWND    HMyTooltip = NULL, HNew = FindWindow( "tooltips_class32", NULL );

// Cycle through all visible tooltip windows looking for the one we want
while (HNew && !HMyTooltip)
{
    if (IsWindowVisible(HNew))
    {
        HMyTooltip = HNew;

        // If you want to find a particular tooltip, check the text (Note: GetWindowText doesn't work)
        SendMessage( HMyTooltip, WM_GETTEXT, ARRAYSIZE(Title), (LPARAM)Title );
        if (_strnicmp( Title, "USB Device Not Recognised", 22 ) != 0)
            HMyTooltip = NULL;
    }

    HNew = GetWindow( HNew, GW_HWNDNEXT );
}