Which window style bits belong to whom?

Raymond Chen

There are 64 bits of styles in the parameters to CreateWindowEx. Which ones belong to whom? Windows defines the meanings of the high word of the dwStyle parameter and all of the bits in the dwExStyle parameter. The low 16 bits of the dwStyle parameter are defined by the implementor of the window class (by the person who calls RegisterClass). In Windows 95, we found several apps that noticed that some bits in the dwExStyle weren’t being used, so they decided to use them for themselves. Then when we added meanings to those bits (such as WS_EX_TOOLWINDOW), these programs started acting funny. So don’t be like those programs. Don’t use bits that don’t belong to you.

If you need more than 16 bits of style information, you can design your class so additional information is passed in the lpParam parameter (the last one) to CreateWindow/Ex, which can be received from the lpCreateParams member of the CREATSTRUCT structure. Alternatively, you can set additional styles with a custom message, such as listview’s LVM_SETEXTENDEDLISTVIEWSTYLE message.

0 comments

Discussion is closed.

Feedback usabilla icon