Windows headers contain a ton of global const's for the various messages. Seems like a very bad way to go about this.

Could one not simply put all these in an enum? e.g., enum WM { WM_CREATE = 1, etc... }?

If so, because there are so many and so many references to them, this can't be done easily by hand. Surely there is a way to automate this? But because the headers are not consistently written, a simple search and replace won't work well?

e.g.,

const WM_* -> add to enum WM;
else WM_* -> WM.*

because there is code like

static if (_WIN32_WINNT >= 0x500) {

        enum {
                WM_CHANGEUISTATE        =       0x0127,
                WM_UPDATEUISTATE        =       0x0128,
                WM_QUERYUISTATE         =       0x0129
        }

        // LOWORD(wParam) values in WM_*UISTATE*
        enum {
                UIS_SET                 =       1,
                UIS_CLEAR               =       2,
                UIS_INITIALIZE  =       3
        }

        // HIWORD(wParam) values in WM_*UISTATE*
        enum {
                UISF_HIDEFOCUS  =       0x1,
                UISF_HIDEACCEL  =       0x2
        }

}

static if (_WIN32_WINNT >= 0x501) {

        // HIWORD(wParam) values in WM_*UISTATE*
        enum {
                UISF_ACTIVE             =       0x4
        }

}

(unless one can define partial enums or use static if in the enums directly(probably the case but parsing is more difficult))


I guessing one would need a D or C parser to deal with all this?

Reply via email to