EnumWindows filter to only windows that show up on alt-tab
Hey People,
I've been working on an application that needs to create a list of all open windows.
So far I've got EnumWindows working with a callback, but I can't seem to filter all windows out that don't show up during alt-tabbing.
How would I filter those windows out ? Below are the checks I already enforced in my callback function.
Code:
if(hWnd == NULL)
return true;
int titleLength = GetWindowTextLength(hWnd);
if(0 == titleLength)
return true;
if( ( false == IsWindowVisible(hWnd) || false == IsIconic(hWnd) ) && false == IsWindow(hWnd))
return true;
if(GetParent(hWnd) != 0)
return true;
// Add it to the list here
So what would I need to add to filter it to windows only seeable on alt-tab ?
Thank you for your time, Xeross
Re: EnumWindows filter to only windows that show up on alt-tab
Hello, xeross,
Did you found solution?
I use the next code to get a list of all opened windows. And it works fine for me.
Code:
static BOOL CALLBACK EnumWindowsCallback(IN HWND hWnd, IN LPARAM lParam)
{
if (!IsWindowVisible(hWnd)) || GetWindow(hWnd, GW_OWNER) != NULL)
return TRUE;
TCHAR szText[256];
DWORD cchText = GetWindowText(hWnd, szText, 256);
if (cchText == 0)
return TRUE;
// there we have a "true" window
}
PS: one window is not wanted. "Program Manager" is a main window which contains a desktop. But this is not a serious problem, isn't it?
Regards, Dimitry
Re: EnumWindows filter to only windows that show up on alt-tab