V
vijlak
Hi All,
I would like to know how to accomplish the following:
First, I would give an example of MFC.
Let's take the CreateButton styles. So, if some one wants to create a
Button they can do a bitwise 'OR' of different styles like
BS_BOTTOM | BS_DEFPUSHBUTTON | BS_LEFT etc.
Let's say each of the button styles is assigned a long value like so:
enum
{
BS_BOTTOM 0x00000001L
BS_DEFPUSHBUTTON 0x00000002L
BS_LEFT 0x00000004L
.
.
.
.
}ButtonStyles;
So when a user creates the above button, how is it handled in the
microsoft source code?
Obviuosly we cannot have an if or switch statement for each
combination, right?
like this:
switch(buttonstyle)
{
case 0x00000007L: //case that handles the above combination
buttonstlesfunc();
:
:
:
so on...
}
Can someone please point out how this type of logic should be coded?
(Obviously if we have 15 button styles there will be 15!
( factorial )
combinations, right? I am guessing something like getting the value
and doing a bitshift or something like that. i am not sure how
though)
Any help is greatly appreciated.
I would like to know how to accomplish the following:
First, I would give an example of MFC.
Let's take the CreateButton styles. So, if some one wants to create a
Button they can do a bitwise 'OR' of different styles like
BS_BOTTOM | BS_DEFPUSHBUTTON | BS_LEFT etc.
Let's say each of the button styles is assigned a long value like so:
enum
{
BS_BOTTOM 0x00000001L
BS_DEFPUSHBUTTON 0x00000002L
BS_LEFT 0x00000004L
.
.
.
.
}ButtonStyles;
So when a user creates the above button, how is it handled in the
microsoft source code?
Obviuosly we cannot have an if or switch statement for each
combination, right?
like this:
switch(buttonstyle)
{
case 0x00000007L: //case that handles the above combination
buttonstlesfunc();
:
:
:
so on...
}
Can someone please point out how this type of logic should be coded?
(Obviously if we have 15 button styles there will be 15!
( factorial )
combinations, right? I am guessing something like getting the value
and doing a bitshift or something like that. i am not sure how
though)
Any help is greatly appreciated.