I thought this could be a big time saver for all of us.
The idea is that if you see a constant you want in the list view you can select it in
the list view and click "Add to builder".
When you add a selection to the builder it will create the code of the constant for
you. You can then send it to the clipboard and paste it into any program you are
currently working on.
You can select multiple constants.
Building up constants.
Here is an example:
If I select BS_LEFT in the list view and click "Add to builder" you will see
CONST BS_LEFT = 0x00000100
has been added to the builder box.
You can then send it to clipboard and paste it into your program.
What if a constant uses another one for it's value?
I have added that in too.
Let's take this:
WM_CHOOSEFONT_GETLOGFONT, it's value is (WM_USER+1)
When you select WM_CHOOSEFONT_GETLOGFONT and add it to the builder,
it will automatically add in WM_USER - like this...
CONST WM_USER = 0x400
CONST WM_CHOOSEFONT_GETLOGFONT = (WM_USER+1)
If you then add another constant to the builder that also requires WM_USER it
won't be added again.
CONST WM_USER = 0x400
CONST WM_CHOOSEFONT_GETLOGFONT = (WM_USER+1)
CONST WM_CHOOSEFONT_SETFLAGS = (WM_USER+102)
What about a constant that uses multiple constnats as it's value?
I have also added this in (up to and including three constants).
WS_EX_OVERLAPPEDWINDOW uses two other constants the value is shown
as (WS_EX_WINDOWEDGE|WS_EX_CLIENTEDGE).
When you add WS_EX_OVERLAPPEDWINDOW to the builder you will be asked
if you want to include these two constants.
Answering Yes gives you this:
CONST WS_EX_WINDOWEDGE = 0x100
CONST WS_EX_CLIENTEDGE = 0x200
CONST WS_EX_OVERLAPPEDWINDOW =
(WS_EX_WINDOWEDGE|WS_EX_CLIENTEDGE)
Answering No just gives you this:
CONST WS_EX_OVERLAPPEDWINDOW =
(WS_EX_WINDOWEDGE|WS_EX_CLIENTEDGE)
Now if we add
CONST WS_EX_PALETTEWINDOW =
(WS_EX_WINDOWEDGE|WS_EX_TOOLWINDOW|WS_EX_TOPMOST)
we get:
CONST WS_EX_WINDOWEDGE = 0x100
CONST WS_EX_CLIENTEDGE = 0x200
CONST WS_EX_OVERLAPPEDWINDOW =
(WS_EX_WINDOWEDGE|WS_EX_CLIENTEDGE)
CONST WS_EX_TOOLWINDOW = 0x80
CONST WS_EX_TOPMOST = 0x8
CONST WS_EX_PALETTEWINDOW =
(WS_EX_WINDOWEDGE|WS_EX_TOOLWINDOW|WS_EX_TOPMOST)
in the builder.
Building up styles.
As you add constants into the builder the style builder is also at work.
Here is an example of multiple styles based on some button constants:
| BS_LEFT | BS_LEFTTEXT | BS_RIGHTBUTTON | SBS_LEFTALIGN
You can toggle between viewing constants and SETIDs via two radio buttons.
A note on SETIDs:
Unlike a constant, SETID cannot apply mathematical operations, simply put you
cannot assign two or more constants to SETID, it has to be one value.
To help along, if you select a constant like this one:
CONST WS_GT = (WS_GROUP|WS_TABSTOP)
The SETID value will be the value of WS_GROUP (0x20000) + the value of
WS_TABSTOP (0x10000).
Which gives us:
SETID "WS_GT",0x30000
This SETID calculation works with any combination of hex or decimal.
Examples of constant / SETID generated values:
'Simple value hex
CONST WS_ACTIVECAPTION = 0x1
SETID "WS_ACTIVECAPTION",0x1
'Simple value dec
CONST ABE_BOTTOM = 3
SETID "ABE_BOTTOM",3
'Value = (Constant)
CONST WS_MINIMIZE =
0x20000000
CONST WS_ICONIC = (WS_MINIMIZE)
SETID "WS_ICONIC",0x20000000
'Value = constant + value
CONST WM_USER = 0x400
CONST WM_CHOOSEFONT_GETLOGFONT = (WM_USER+1)
SETID "WM_CHOOSEFONT_GETLOGFONT",0x401
'Value = constant - value
CONST CBEN_FIRST =
-800
CONST CBEN_BEGINEDIT = (CBEN_FIRST-4)
SETID "CBEN_BEGINEDIT",-804
'Value = (Multiple | Constants)
CONST WS_GROUP = 0x20000
CONST WS_TABSTOP = 0x10000
CONST WS_GT = (WS_GROUP|WS_TABSTOP)
SETID "WS_GT",0x30000
'Final example
CONST WS_CAPTION = 0xc00000
CONST WS_MAXIMIZEBOX =
0x10000
CONST WS_MINIMIZEBOX = 0x20000
CONST WS_OVERLAPPED = 0x0
CONST WS_SYSMENU = 0x80000
CONST WS_THICKFRAME =
0x40000
CONST WS_OVERLAPPEDWINDOW =
(WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_THICKFRAME|WS_MINIMIZEBOX|WS_MAXIMIZEBOX)
SETID "WS_OVERLAPPEDWINDOW",0xCF0000
'Value = (Constant) where (Constant) value has (Multiple | Constants)
CONST WS_TILEDWINDOW = (WS_OVERLAPPEDWINDOW)
SETID "WS_TILEDWINDOW",0xCF0000
Very useful I think! but don't rely on the value for SETID if
'Value = (Constant) where (Constant) value has (Multiple | Constants) and they in
turn have multiple values.
I use Include files - won't I get conflicts?
No, you should not get any, the values are the same as in the include files.