Alt Tab overlay Win32 identificator

2019-06-20 08:25发布

I'm mapping events coming from an external sensor (e.g. a keypad) to keyboard shortcuts and I would like to switch applications using the Fast switch overlay window ( i.e. Alt-Tab menu"), but I want to keep showing the switch menu until an application is chosen.

Basically, what am I doing is this :

if(notInSwitchMenu) 
{   // Alt-Tab keystroke, but Alt remains pressed : the menu is still visible
    Press(VK_MENU); 
    Press(VK_TAB); 
    Release(VK_TAB);
}
else
{

    if(event1) //Tab keystroke : next app
    {
        Press(VK_TAB);
        Release(VK_TAB) ;
    } 
    else if(event2) //Shift-Tab keystroke  : previous app
    { 
        Press(VK_SHIFT); 
        Press(VK_TAB);
        Release(VK_TAB);
        Release(VK_SHIFT) 
    }
    else if(event3) // we get out of the menu : the selected app has the focus.
    {
        Release(VK_MENU);
    } 
}

The Press and Release simply call SendInput with the right properties.

My problem is that I don't know a robust method to determine if the user is currently in the Alt-Tab program list. Do anyone know how to identify the Alt-Tab overlay menu with the Win32 API ?

1条回答
We Are One
2楼-- · 2019-06-20 08:43

The EVENT_SYSTEM_SWITCHSTART/EVENT_SYSTEM_SWITCHEND events tell you when the Alt+Tab window appears and disappears.

查看更多
登录 后发表回答