I am looking for a way to check if a given window has a taskbar button. That is, given a handle to a window, I need a TRUE if the window is in the taskbar, and FALSE otherwi
Windows uses heuristics to decide whether or not to give a taskbar button to a window, and sometimes there is a delay before it can decide, so doing this 100% accurately is going to be quite hard. Here's a rough start on the rules. There are modern style flags that make it easy to know, but when those styles are missing the taskbar is reduced to guessing.
First off, you will need both of the the window style flags.
LONG Style = GetWindowLong(hwnd, GWL_STYLE);
LONG ExStyle = GetWindowLong(hwnd, GWL_EXSTYLE);
Now the rules, there are three rules that are certain.
ExStyle & WS_EX_APPWINDOW
, then TASKBARExStyle & WS_EX_TOOLWINDOW
, then NOT_TASKBARStyle & WS_CHILD
then NOT_TASKBARThe rest are guesses:
Style & WS_OVERLAPPED
suggests TASKBARStyle & WS_POPUP
suggests NOT_TASKBAR especially if GetParent() != NULL
ExStyle & WS_EX_OVERLAPPEDWINDOW
suggests TASKBARExStyle & WS_EX_CLIENTEDGE
suggests NOT_TASKBARExStyle & WS_EX_DLGMODALFRAME
suggests NOT_TASKBARI'm sure that there are other rules for guessing, and in fact that the guessing rules have changed from version to version of Windows.