I'm not able to use GetAltTabInfo. Probably a stupid mistake but what's wrong with this?
HWND taskSwitcher = FindWindow(L"TaskSwitcherWnd", L"Task Switching");
ALTTABINFO altTabInfo = {};
altTabInfo.cbSize = sizeof(ALTTABINFO);
GetAltTabInfo(taskSwitcher, -1, &altTabInfo, NULL, 0);
I have verified that taskSwitcher is the task switching window after the call to FindWindow (whether it is visible or not). All fields of altTabInfo remain 0 after the call to GetAltTabInfo except cbSize which was set to 40 by the assignment to sizeof(ALTTABINFO). I'm trying this on a windows 7 machine.
Alternative methods to extract the number of windows?
Thanks
Edit: Ok, I just realized I may get some error info. The result value of the GetAltTabInfo call is indeed 0 and GetLastError gives me either 1400 (Invalid window handle) or 1168 (Element not found) if I specify NULL for the hwnd parameter (it was after all defined to be __in_opt). So I guess I'm passing the wrong window. What is the right one if not the one returned by FindWindow(L"TaskSwitcherWnd", L"Task Switching")? MSDN only tells me about the hwnd parameter that "This window must be the application-switching window".