Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

CreateWindow COMBOBOX without any CBS_ style set : what am I getting ?

7 views
Skip to first unread message

R.Wieser

unread,
Dec 24, 2022, 2:35:22 AM12/24/22
to
Hello all,

I'm putting a combobox onto a dialog using CreateWindowEx, only setting the
WS_VISIBLE and WS_CHILD styles (no CBS_* ones). As a result I get something
that looks the same as if I specified the CBS_DROPDOWN style.

Question : what am I actually getting / whats the difference between no
style and the CBS_DROPDOW one ?

Regards,
Rudy Wieser


JJ

unread,
Dec 25, 2022, 12:12:39 PM12/25/22
to
Considering that a combobox can only have 3 main styles where all of them
are non zero, it has to have a default style to represent style with zero
value. That default style is CBS_SIMPLE. Whether CBS_SIMPLE is specified or
not when the control is created, and whether the style value of the created
control actually has CBS_SIMPLE or not. It's kind of weird, but that's just
how it is.

Some controls would complain if they're created with an invalid style, but
at least combobox, doesn't complain.

R.Wieser

unread,
Dec 25, 2022, 2:59:33 PM12/25/22
to
JJ,

> Considering that a combobox can only have 3 main styles where all
> of them are non zero, it has to have a default style to represent
> style with zero value.

:-) You're working your way back from the answer to the question, instead
of starting with the question and try to figure out what the answer is.

So no, I don't agree with either. 3 is not some magical number and a
"default style" is, to me, just the 'unspecified behaviour' you're left with
when you've handled all specified cases.

> It's kind of weird, but that's just how it is.

I know it is. Starting with two style values doing the exact same thing is
odd. I could have accepted it at the end of the range (styles 4 and
higher - there seem to room for 16 styles), but not the start. Thats why I
was asking. :-)

Regards,
Rudy Wieser


JJ

unread,
Dec 25, 2022, 7:00:45 PM12/25/22
to
On Sun, 25 Dec 2022 19:49:39 +0100, R.Wieser wrote:
>
> I know it is. Starting with two style values doing the exact same thing is
> odd. I could have accepted it at the end of the range (styles 4 and
> higher - there seem to room for 16 styles), but not the start. Thats why I
> was asking. :-)
>
> Regards,
> Rudy Wieser

Well, only Microsoft knows why the main style value starts from 1 instead of
0.

R.Wieser

unread,
Dec 26, 2022, 1:44:16 AM12/26/22
to

"JJ" <jj4p...@outlook.com> wrote in message
news:cuzdapnd05jl$.17yf0pb3dgpym.dlg@40tude.net...

> Well, only Microsoft knows why the main style value starts from 1
> instead of 0.

I was hoping someone else, hopefully present in this newsgroup, would know
too. Alas.

By the way, I probably will throw all the 16 values at it to see if I can
spot a pattern. Perhaps I will even find another undocumented style !

And thanks for the reply - even though I seldom seem to be agreeing with you
... :-)

Regards,
Rudy Wieser


0 new messages