The Second Extended Window Style

It was only ever inevitable that the WND structure would need yet more bit flags than the age-old state, style and ExStyle, even after the addition of state2 for version 4.0. The first surprise when more came for version 6.0 is the name. The bit fields are in union with a ULONG named ExStyle2, but none of the bits is an extended window style. Though one does at least affect what’s reported as the window’s extended style, the set is very much more an extension of state and state2 than of style and ExStyle.

Another surprise is that although the new ExStyle2 was appended to the WND, and is thus disjoint from the other sets of bit flags, the 16-bit encoding of window flags as if state, state2, ExStyle and style make a large array of bits extends to the ExStyle2 too. In this encoding of any window flag, the high byte is a byte offset from the state to the bit and the low byte is a bit mask within the byte. Though version 6.0 is not known to use this encoding for the ExStyle2 bits, the use is well established by version 6.1.

Mask Window Flag Index Definition Versions Remarks
0x00000001 0x9801
INT bClipboardListener : 1;
6.0 and higher  
0x00000002 0x9802
INT bLayeredInvalidate : 1;
6.0 and higher  
0x00000004 0x9804
INT bRedirectedForPrint : 1;
6.0 and higher  
0x00000008 0x9808
INT bLinked : 1;
6.0 and higher  
0x00000010 0x9810   6.2 and higher no use yet known
0x00000010 (6.0 to 6.1);
0x9810 (6.0 to 6.1);
INT bLayeredForDWM : 1;
6.0 and higher  
0x00000020 (6.0 to 6.1);
0x9820 (6.0 to 6.1);
INT bLayeredLimbo : 1;
6.0 and higher  
0x00000040 (6.0 to 6.1);
6.0 and higher  

The bRedirectedForPrint flag provides another good example of efficiency that results from the visibility of the WND in user mode. The USER32 export IsWindowRedirectedForPrint needs no kernel-mode transition: it merely resolves the window handle to a pointer and extracts this bit.

Version 6.2 evidently inserted a bit, shifting others to higher values, but I don’t yet know what for, let alone why.

If bLayeredForDWM is set, then the extended window styles produced by the GWL_EXSTYLE case of the USER32 function GetWindowLong have WS_EX_LAYERED clear.

Appended For Windows 7

Mask Window Flag Index Definition Versions
0x00000080 (6.1);
0x9880 (6.1);
INT bVerticallyMaximizedLeft : 1;
6.1 and higher
0x00000100 (6.1);
0x9901 (6.1);
INT bVerticallyMaximizedRight : 1;
6.1 and higher
0x00000200 (6.1);
0x9902 (6.1);
INT bHasOverlay : 1;
6.1 and higher
0x00000400 (6.1);
0x9904 (6.1);
INT bConsoleWindow : 1;
6.1 and higher
0x00000800 (6.1);
0x9908 (6.1);
INT bChildNoActivate : 1;
6.1 and higher

Appended Since Windows 7

Microsoft’s names and definitions for bits that have been defined since Windows 7 may never be known. If only for now, I can contribute no more than placeholders.

Mask Window Flag Index Versions
0x00002000 0x9920 6.2 and higher
0x00004000 0x9940 6.2 and higher
0x00008000 0x9980 6.3 and higher
0x00010000 0x9A01 6.3 and higher
0x00020000 0x9A02 6.3 and higher
0x00040000 0x9A04 6.3 and higher
0x00080000 0x9A08 10.0 and higher
0x00100000 0x9A10 6.3 and higher
0x00200000 0x9A20 6.3 and higher
0x00400000 0x9A40 10.0 and higher
0x00800000 0x9A80 10.0 and higher
0x01000000 0x9B01 10.0 and higher
0x02000000 0x9B02 10.0 and higher
0x04000000 0x9B04 10.0 and higher

If the 0x00080000 bit is used in version 6.3, I don’t yet know where.