Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a range of Window Style or Extended Window Style values reserved for custom control usage?

Tags:

c++

winapi

I am looking for the Window Styles or Extended Window Styles equivalent to the WM_USER or WM_APP constants and specified ranges used with window messages. I am working on an custom control library and want to define styles that will not conflict with styles used for the window itself. I understand that the binary values should be mutually exclusive to support ORing of styles. I cannot find any documentation where such a range is specified.

like image 566
vishayp Avatar asked Oct 16 '25 19:10

vishayp


1 Answers

Not explicitly documented on MSDN, but confirmed by Raymond Chen's blog:

Which window style bits belong to whom?:

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).

You can confirm this by looking at the defined styles of standard Win32 control classes, which have overlapping bits. For example, BS_DEFPUSHBUTTON for BUTTON, ES_CENTER for EDIT, SS_CENTER for STATIC, etc are all defined as 0x00000001, but are all usable in the dwStyle parameter depending on which registered class is being created.

Raymond's blog post also says:

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.

like image 161
Remy Lebeau Avatar answered Oct 18 '25 12:10

Remy Lebeau



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!