Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Alt Tab overlay Win32 identificator

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 ?

like image 291
lucasg Avatar asked Oct 12 '12 15:10

lucasg


1 Answers

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

like image 96
Raymond Chen Avatar answered Sep 27 '22 19:09

Raymond Chen