5

我有一个关于窗口样式十六进制的问题。

根据http://support.microsoft.com/kb/111011/en-us0x16CF0000包含WS_VISIBLEWS_CLIPSIBLINGSWS_CLIPCHILDRENWS_CAPTIONWS_SYSMENUWS_THICKFRAMEWS_MINIMIZEBOX和的窗口样式WS_MAXIMIZEBOX

如何检查窗口样式是否存在于窗口样式组合中?例如,我想检查WS_BORDER( 0x00800000) 样式是否存在于0x16CF0000.

4

7 回答 7

7

标准形式是:

if (value & WS_BORDER != 0) {  }

& 将执行按位与,并且仅当设置了 WS_BORDER 的位时,结果才会非零

于 2009-08-14T20:56:28.117 回答
3

基本上,您可以检查是否yourValue AND WS_BORDER = WS_BORDER.

不幸的是,样式标志内的某些位被使用了两次,具体取决于上下文,例如WS_TABSTOPWS_MAXIMIZEBOX都是 0x00010000,因此它取决于上下文(对象的位置,可能还有其他标志)窗口是否真的具有该属性(虽然父控件不能有制表位,但子控件有时可以有一个最大化框)......

WS_OVERLAPPED      = 0x00000000,
WS_POPUP           = 0x80000000,
WS_CHILD           = 0x40000000,
WS_MINIMIZE        = 0x20000000,
WS_VISIBLE         = 0x10000000,
WS_DISABLED        = 0x08000000,
WS_CLIPSIBLINGS    = 0x04000000,
WS_CLIPCHILDREN    = 0x02000000,
WS_MAXIMIZE        = 0x01000000,
WS_BORDER          = 0x00800000,
WS_DLGFRAME        = 0x00400000,
WS_VSCROLL         = 0x00200000,
WS_HSCROLL         = 0x00100000,
WS_SYSMENU         = 0x00080000,
WS_THICKFRAME      = 0x00040000,
WS_GROUP           = 0x00020000,
WS_TABSTOP         = 0x00010000,

WS_MINIMIZEBOX     = 0x00020000,
WS_MAXIMIZEBOX     = 0x00010000,

WS_CAPTION         = WS_BORDER | WS_DLGFRAME,
WS_TILED           = WS_OVERLAPPED,
WS_ICONIC          = WS_MINIMIZE,
WS_SIZEBOX         = WS_THICKFRAME,
WS_TILEDWINDOW     = WS_OVERLAPPEDWINDOW,

WS_OVERLAPPEDWINDOW    = WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | 
                         WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX,
WS_POPUPWINDOW     = WS_POPUP | WS_BORDER | WS_SYSMENU,
WS_CHILDWINDOW     = WS_CHILD,
于 2009-08-14T21:02:37.620 回答
2
if(0x16CF0000 & WS_BORDER)
于 2009-08-14T20:55:32.317 回答
1

查看IF((0x16CF0000 | WS_BORDER) == 0x16CF0000)

于 2009-08-14T20:57:26.650 回答
1

过去,我使用定义此类内容的头文件并编写了一个脚本将其转换为代码,该代码将获取标志所在的变量并将其转换为包含常量符号名称的文本字符串。

在我使用 AWK 之类的工具执行此操作的那一天,解析 #defines 相当容易。现在,如果我在当时使用的机器上安装了它,Python 或者如果 Python 不是现成的,我会退回到 AWK。

于 2009-08-14T21:13:08.847 回答
0

这个问题真的让我很担心,因为我正在创建一个 win32 对话框构建器。其中一项功能是设置所有 win32 通用控件的样式,以及用户定义的控件。通过观察和 MSDN 提供的少量文档,我学到了很多东西;我希望分享我的信息。这将超出回答这个问题。

微软团队是如何格式化他们的窗口样式的?

  1. 它们是适用于所有窗口的通用窗口样式。它们以“WS_”开头,位于高位。0xffff0000。

  2. 然后是控件特定/用户定义的样式,它们以其指定的前缀开头。比如BS代表ButtonStyle,CBS代表ComboBoxStyle,等等。它们位于低位。0x0000ffff。

这两个级别的样式有5种类型:

  1. 默认 - 这些类型的样式等于零。仅当样式等于零时才选择此样式。

  2. 标志 - 这些类型的样式从不等于零,并且放置在唯一的位上。这意味着这些样式可以同时使用。

  3. 独占 - 这些类型的样式通常彼此共享位。但不一定是这种情况,因为 WS_POPUP 和 WS_CHILD 是独占的,但它们不共享位。大多数其他样式,如 CBS_SIMPLE 和 CBS_DROPDOWN 是排他的,实际上共享位。独家风格通常代表一个类别。BS_OWNERDRAW、BS_RADIOBUTTON、BS_PUSHBUTTON 都代表按钮类别的类型。BS_CENTER、BS_LEFT、BS_TOP 是对齐类别。请注意,BS_PUSHBUTTON 等于 0,表示类型类别的默认值。

  4. 复合 - 这些样式由多种样式组成。如WS_OVERLAPPEDWINDOW、WS_POPUPWINDOW、DS_SHELLFONT、LBS_STANDARD。

  5. 同义词 - 这些样式指的是同一件事。例如:WS_CHILDWINDOW 与 WS_CHILD、WS_TILED 与 WS_OVERLAPPED、WS_TILEDWINDOW 与 WS_OVERLAPPEDWINDOW。请注意,WS_TABSTOP 和 WS_MAXIMIZEBOX 共享相同的值,但它们不是同义词,因为它们在语义上不同。如何?这超出了我的知识范围。WS_TABSTOP 应用于对话框中使用的控件,并且对话框实现正确的行为。但是,您可以使用 isDialogMessage 在对话框之外模拟相同的行为。子窗口可以有最大化框。对于我的应用程序,我完全忽略了 WS_TABSTOP 样式。

我们如何测试一种风格?我创建了一个将样式转换为字符串的函数。但是,测试一种样式是否存在于另一种样式中的函数可能不切实际,因为这需要大量上下文。示例函数原型如下所示...

/** \param className - use WC_DIALOG for dialog window
                       use NULL for top level window
*/
bool hasWindowStyle(const char *className,UINT style,UINT requiredStyle);

className 将用作主要上下文。如果 className 是 WC_DIALOG,则所有 DS_* 样式都可用于窗口。但它不能有属于按钮类、编辑类等的样式。问题是,以下在技术上是错误的......

return (style & requiredStyle) == requiredStyle;

这是错误的,因为即使样式中存在 requiredStyle,也不意味着 requiredStyle 是特定类名的有效样式。这将要求我们拥有特定类的所有样式的映射,并且仅当该映射中存在 requiredStyle 时,才返回上述公式。

std::map<std::string,UINT> win32_class_list;

auto elem = win32_class_list.find(className);
auto invalid = win32_class_list.end();

if(elem == invalid) return false;
else return (style & requiredStyle) == requiredStyle;

以上解决了第一个问题。但最后一个问题似乎无法解决。假设您有一个必需的样式,即 CBS_SIMPLE|CBS_LOWERCASE。您将如何确定此所需样式是否与组合框样式分开。这是一个非常上下文的问题。

查看我的第 2 部分,了解将窗口样式转换为字符串的函数。

于 2021-11-28T19:51:51.293 回答
0

第2部分

用于将窗口样式转换为字符串的一般函数。希望这对某人有用。请注意,由于空间原因,您必须实现以下两个函数原型。

Jav/字符串/builder.h

/** \brief builds a string from parts and appends it to result.
    \param result
    \param format a format string similar to sprintf, except that '?' is 
           the only format specifier. C++ template system automatically
           deduces the type and count of format specifiers.
    \param arg first argument of parameter pack is always const char* in
           this case.
    \param REST... rest of parts. Can support any and every C++ type.  
  */
template<class ...REST>
void buildString(std::string &result,const char *format,const char *arg,REST...);

Jav/字符串/numconv.h

/** \brief converts num to a hexidecimal string consisting of a
           hexidecimal prefix '0x'.  
  */
const char* hex_string(uint num);

win_styles.cpp

namespace {

enum { USER_DEFINED_STYLE_MASK = 0xffff };

struct ClassNameCompare
{
    bool operator()(const char *lhs,const char *rhs)
    {
     return strcmp(lhs,rhs) < 0;
    }
};

using Win32StyleExpert = void(*)(std::string&,uint,const char*);
using Win32ClassList = std::map<const char*,Win32StyleExpert,ClassNameCompare>;

extern Win32ClassList win32_class_list;

Win32StyleExpert getWin32StyleExpert(const char *className)
{
 auto elem = win32_class_list.find(className);
 return elem == win32_class_list.end() ? NULL : &elem->second;
}

}

std::string windowStyleToString(const char *className,uint style,const char *sep)
{
    std::string s;

    if( (style & WS_OVERLAPPEDWINDOW) == WS_OVERLAPPEDWINDOW ) buildString(s,"??","WS_OVERLAPPEDWINDOW",sep);
    else
    {
     if( (style & WS_SIZEBOX) == WS_SIZEBOX ) buildString(s,"??","WS_SIZEBOX",sep);
     if( (style & WS_MINIMIZEBOX) == WS_MINIMIZEBOX )   buildString(s,"??","WS_MINIMIZEBOX",sep);
     if( (style & WS_MAXIMIZEBOX) == WS_MAXIMIZEBOX )   buildString(s,"??","WS_MAXIMIZEBOX",sep);
     if( (style & WS_SYSMENU) == WS_SYSMENU )   buildString(s,"??","WS_SYSMENU",sep);

     if( (style & WS_CAPTION) == WS_CAPTION )   buildString(s,"??","WS_CAPTION",sep);
     else if( (style & WS_BORDER) == WS_BORDER )    buildString(s,"??","WS_BORDER",sep);
    }

    if( (style & WS_CHILD) == WS_CHILD )buildString(s,"??","WS_CHILD",sep);
    else if( (style & WS_POPUP) == WS_POPUP ) buildString(s,"??","WS_POPUP",sep);

    if( (style & WS_MINIMIZE) == WS_MINIMIZE )  buildString(s,"??","WS_MINIMIZE",sep);
    if( (style & WS_MAXIMIZE) == WS_MAXIMIZE )  buildString(s,"??","WS_MAXIMIZE",sep);
    if( (style & WS_DISABLED) ==  WS_DISABLED)  buildString(s,"??","WS_DISABLED",sep);
    if( (style & WS_HSCROLL) ==  WS_HSCROLL)    buildString(s,"??","WS_HSCROLL",sep);
    if( (style & WS_VSCROLL) ==  WS_VSCROLL)    buildString(s,"??","WS_VSCROLL",sep);
    if( (style & WS_VISIBLE) ==  WS_VISIBLE)    buildString(s,"??","WS_VISIBLE",sep);

    if( (style & WS_DLGFRAME) ==  WS_DLGFRAME && (style & WS_CAPTION) != WS_CAPTION)
            buildString(s,"??","WS_DLGFRAME",sep);


    if((int)className == (int)WC_DIALOG)
    {
        if( (style & DS_SHELLFONT) == DS_SHELLFONT ) buildString(s,"??","DS_SHELLFONT",sep);
        else
        {
         if( (style & DS_FIXEDSYS) == DS_FIXEDSYS ) buildString(s,"??","DS_FIXEDSYS",sep);
         if( (style & DS_SETFONT) == DS_SETFONT )   buildString(s,"??","DS_SETFONT",sep);
        }

        if( (style & DS_ABSALIGN) == DS_ABSALIGN )  buildString(s,"??","DS_ABSALIGN",sep);
        if( (style & DS_CENTER) == DS_CENTER )  buildString(s,"??","DS_CENTER",sep);
        if( (style & DS_CENTERMOUSE) == DS_CENTERMOUSE )    buildString(s,"??","DS_CENTERMOUSE",sep);
        if( (style & DS_CONTEXTHELP) == DS_CONTEXTHELP )    buildString(s,"??","DS_CONTEXTHELP",sep);
        if( (style & DS_CONTROL) == DS_CONTROL )    buildString(s,"??","DS_CONTROL",sep);
        if( (style & DS_LOCALEDIT) == DS_LOCALEDIT )    buildString(s,"??","DS_LOCALEDIT",sep);
        if( (style & DS_MODALFRAME) == DS_MODALFRAME )  buildString(s,"??","DS_MODALFRAME",sep);
        if( (style & DS_NOFAILCREATE) == DS_NOFAILCREATE )  buildString(s,"??","DS_NOFAILCREATE",sep);
        if( (style & DS_SETFOREGROUND) == DS_SETFOREGROUND )    buildString(s,"??","DS_SETFOREGROUND",sep);
    }
    else if(auto pushStyle = getWin32StyleExpert(className))
    {
     if(style == 0) return "0";
     else pushStyle(s,style,sep);
    }
    else if( style == WS_OVERLAPPED ) return "WS_OVERLAPPED";
    else if(className == NULL) buildString(s,"??",Jav::hex_str(style&USER_DEFINED_STYLE_MASK),sep);

    if(s.empty()) return "";

    s.pop_back(); //remove the last seperator added
    return s;
}

namespace {

void pushAnimateControlStyle(std::string &s,uint style,const char *sep)
{
    if( (style & ACS_AUTOPLAY) == ACS_AUTOPLAY )    buildString(s,"??","ACS_AUTOPLAY",sep);
    if( (style & ACS_CENTER) == ACS_CENTER )    buildString(s,"??","ACS_CENTER",sep);
    if( (style & ACS_TIMER) == ACS_TIMER )  buildString(s,"??","ACS_TIMER",sep);
}

void pushButtonStyle(std::string &s,uint style,const char *sep)
{
    if( (style & 0xf) == BS_3STATE )buildString(s,"??","BS_3STATE",sep);
    else if( (style & 0xf) == BS_AUTO3STATE )   buildString(s,"??","BS_AUTO3STATE",sep);
    else if( (style & 0xf) == BS_AUTOCHECKBOX ) buildString(s,"??","BS_AUTOCHECKBOX",sep);
    else if( (style & 0xf) == BS_AUTORADIOBUTTON )  buildString(s,"??","BS_AUTORADIOBUTTON",sep);
    else if( (style & 0xf) == BS_CHECKBOX ) buildString(s,"??","BS_CHECKBOX",sep);
    else if( (style & 0xf) == BS_DEFPUSHBUTTON )    buildString(s,"??","BS_DEFPUSHBUTTON",sep);
    else if( (style & 0xf) == BS_GROUPBOX ) buildString(s,"??","BS_GROUPBOX",sep);
    else if( (style & 0xf) == BS_OWNERDRAW )    buildString(s,"??","BS_OWNERDRAW",sep);
    else if( (style & 0xf) == BS_RADIOBUTTON )  buildString(s,"??","BS_RADIOBUTTON",sep);
    else buildString(s,"??","BS_PUSHBUTTON",sep);

    if( (style & 0xc0) == BS_BITMAP )buildString(s,"??","BS_BITMAP",sep);
    else if( (style & 0xc0) == BS_ICON )buildString(s,"??","BS_ICON",sep);
    else buildString(s,"??","BS_TEXT",sep);

    if( (style & 0xf00) == BS_CENTER )buildString(s,"??","BS_CENTER",sep);
    else if( (style & 0xf00) == BS_VCENTER )    buildString(s,"??","BS_VCENTER",sep);
    else if( (style & 0xf00) == BS_LEFT )buildString(s,"??","BS_LEFT",sep);
    else if( (style & 0xf00) == BS_TOP )buildString(s,"??","BS_TOP",sep);
    else if( (style & 0xf00) == BS_RIGHT )buildString(s,"??","BS_RIGHT",sep);
    else if( (style & 0xf00) == BS_BOTTOM )buildString(s,"??","BS_BOTTOM",sep);

    if( (style & BS_FLAT) == BS_FLAT )buildString(s,"??","BS_FLAT",sep);
    if( (style & BS_MULTILINE) == BS_MULTILINE )    buildString(s,"??","BS_MULTILINE",sep);
    if( (style & BS_NOTIFY) == BS_NOTIFY )buildString(s,"??","BS_NOTIFY",sep);
    if( (style & BS_PUSHLIKE) == BS_PUSHLIKE )  buildString(s,"??","BS_PUSHLIKE",sep);
    if( (style & BS_LEFTTEXT) == BS_LEFTTEXT )  buildString(s,"??","BS_LEFTTEXT",sep);
}

void pushComboBoxExStyle(std::string &s,uint style,const char *sep)
{
    if( (style & CBES_EX_CASESENSITIVE) == CBES_EX_CASESENSITIVE )  buildString(s,"??","CBES_EX_CASESENSITIVE",sep);
    if( (style & CBES_EX_NOEDITIMAGE) == CBES_EX_NOEDITIMAGE )  buildString(s,"??","CBES_EX_NOEDITIMAGE",sep);
    if( (style & CBES_EX_NOEDITIMAGEINDENT) == CBES_EX_NOEDITIMAGEINDENT )  buildString(s,"??","CBES_EX_NOEDITIMAGEINDENT",sep);
    if( (style & CBES_EX_NOSIZELIMIT) == CBES_EX_NOSIZELIMIT )  buildString(s,"??","CBES_EX_NOSIZELIMIT",sep);
    if( (style & CBES_EX_PATHWORDBREAKPROC) == CBES_EX_PATHWORDBREAKPROC )  buildString(s,"??","CBES_EX_PATHWORDBREAKPROC",sep);
}

void pushComboBoxStyle(std::string &s,uint style,const char *sep)
{
    if( (style & 3) == CBS_SIMPLE )buildString(s,"??","CBS_SIMPLE",sep);
    else if( (style & 3) == CBS_DROPDOWN )  buildString(s,"??","CBS_DROPDOWN",sep);
    else if( (style & 3) == CBS_DROPDOWNLIST )  buildString(s,"??","CBS_DROPDOWNLIST",sep);

    if( (style & 0x30) == CBS_OWNERDRAWFIXED )  buildString(s,"??","CBS_OWNERDRAWFIXED",sep);
    else if( (style & 0x30) == CBS_OWNERDRAWVARIABLE )  buildString(s,"??","CBS_OWNERDRAWVARIABLE",sep);

    if( (style & 0x6000) == CBS_LOWERCASE ) buildString(s,"??","CBS_LOWERCASE",sep);
    else if( (style & 0x6000) == CBS_UPPERCASE )    buildString(s,"??","CBS_UPPERCASE",sep);

    if( (style & CBS_DISABLENOSCROLL) == CBS_DISABLENOSCROLL )  buildString(s,"??","CBS_DISABLENOSCROLL",sep);
    if( (style & CBS_NOINTEGRALHEIGHT) == CBS_NOINTEGRALHEIGHT )    buildString(s,"??","CBS_NOINTEGRALHEIGHT",sep);
    if( (style & CBS_SORT) == CBS_SORT )buildString(s,"??","CBS_SORT",sep);
    if( (style & CBS_AUTOHSCROLL) == CBS_AUTOHSCROLL )  buildString(s,"??","CBS_AUTOHSCROLL",sep);
    if( (style & CBS_OEMCONVERT) == CBS_OEMCONVERT )    buildString(s,"??","CBS_OEMCONVERT",sep);
}

void pushEditControlStyle(std::string &s,uint style,const char *sep)
{
    if( (style & 0x3) == ES_CENTER )buildString(s,"??","ES_CENTER",sep);
    else if( (style & 0x3) == ES_RIGHT )buildString(s,"??","ES_RIGHT",sep);

    if( (style & 0x18) == ES_LOWERCASE )    buildString(s,"??","ES_LOWERCASE",sep);
    else if( (style & 0x18) == ES_UPPERCASE )   buildString(s,"??","ES_UPPERCASE",sep);

    if( (style & ES_AUTOHSCROLL) == ES_AUTOHSCROLL )    buildString(s,"??","ES_AUTOHSCROLL",sep);
    if( (style & ES_AUTOVSCROLL) == ES_AUTOVSCROLL )    buildString(s,"??","ES_AUTOVSCROLL",sep);
    if( (style & ES_MULTILINE) == ES_MULTILINE )    buildString(s,"??","ES_MULTILINE",sep);
    if( (style & ES_NOHIDESEL) == ES_NOHIDESEL )    buildString(s,"??","ES_NOHIDESEL",sep);
    if( (style & ES_NUMBER) == ES_NUMBER )  buildString(s,"??","ES_NUMBER",sep);
    if( (style & ES_OEMCONVERT) == ES_OEMCONVERT )  buildString(s,"??","ES_OEMCONVERT",sep);
    if( (style & ES_PASSWORD) == ES_PASSWORD )  buildString(s,"??","ES_PASSWORD",sep);
    if( (style & ES_READONLY) == ES_READONLY )  buildString(s,"??","ES_READONLY",sep);
    if( (style & ES_WANTRETURN) == ES_WANTRETURN )  buildString(s,"??","ES_WANTRETURN",sep);
}

void pushHeaderControlStyle(std::string &s,uint style,const char *sep)
{
    if( (style & HDS_BUTTONS) == HDS_BUTTONS )  buildString(s,"??","HDS_BUTTONS",sep);
    if( (style & HDS_DRAGDROP) == HDS_DRAGDROP )    buildString(s,"??","HDS_DRAGDROP",sep);
    if( (style & HDS_FILTERBAR) == HDS_FILTERBAR )  buildString(s,"??","HDS_FILTERBAR",sep);
    if( (style & HDS_FULLDRAG) == HDS_FULLDRAG )    buildString(s,"??","HDS_FULLDRAG",sep);
    if( (style & HDS_HIDDEN) == HDS_HIDDEN )    buildString(s,"??","HDS_HIDDEN",sep);
    if( (style & HDS_HORZ) == HDS_HORZ )    buildString(s,"??","HDS_HORZ",sep);
    if( (style & HDS_HOTTRACK) == HDS_HOTTRACK )    buildString(s,"??","HDS_HOTTRACK",sep);
}

void pushListBoxStyle(std::string &s,uint style,const char *sep)
{
    if( (style & 0x30) == LBS_OWNERDRAWFIXED )  buildString(s,"??","LBS_OWNERDRAWFIXED",sep);
    else if( (style & 0x30) == LBS_OWNERDRAWVARIABLE )  buildString(s,"??","LBS_OWNERDRAWVARIABLE",sep);

    if( (style & LBS_DISABLENOSCROLL) == LBS_DISABLENOSCROLL )  buildString(s,"??","LBS_DISABLENOSCROLL",sep);
    if( (style & LBS_EXTENDEDSEL) == LBS_EXTENDEDSEL )  buildString(s,"??","LBS_EXTENDEDSEL",sep);
    if( (style & LBS_HASSTRINGS) == LBS_HASSTRINGS )    buildString(s,"??","LBS_HASSTRINGS",sep);
    if( (style & LBS_MULTICOLUMN) == LBS_MULTICOLUMN )  buildString(s,"??","LBS_MULTICOLUMN",sep);
    if( (style & LBS_MULTIPLESEL) == LBS_MULTIPLESEL )  buildString(s,"??","LBS_MULTIPLESEL",sep);
    if( (style & LBS_NODATA) == LBS_NODATA )    buildString(s,"??","LBS_NODATA",sep);
    if( (style & LBS_NOINTEGRALHEIGHT) == LBS_NOINTEGRALHEIGHT )    buildString(s,"??","LBS_NOINTEGRALHEIGHT",sep);
    if( (style & LBS_NOREDRAW) == LBS_NOREDRAW )    buildString(s,"??","LBS_NOREDRAW",sep);
    if( (style & LBS_NOSEL) == LBS_NOSEL )  buildString(s,"??","LBS_NOSEL",sep);
    if( (style & LBS_NOTIFY) == LBS_NOTIFY )    buildString(s,"??","LBS_NOTIFY",sep);
    if( (style & LBS_SORT) == LBS_SORT )    buildString(s,"??","LBS_SORT",sep);
    if( (style & LBS_USETABSTOPS) == LBS_USETABSTOPS )  buildString(s,"??","LBS_USETABSTOPS",sep);
    if( (style & LBS_WANTKEYBOARDINPUT) == LBS_WANTKEYBOARDINPUT )  buildString(s,"??","LBS_WANTKEYBOARDINPUT",sep);
}

void pushListViewStyle(std::string &s,uint style,const char *sep)
{
    if( (style & LVS_TYPEMASK) == LVS_REPORT )  buildString(s,"??","LVS_REPORT",sep);
    else if( (style & LVS_TYPEMASK) == LVS_LIST )   buildString(s,"??","LVS_LIST",sep);
    else if( (style & LVS_TYPEMASK) == LVS_SMALLICON )  buildString(s,"??","LVS_SMALLICON",sep);
    else buildString(s,"??","LVS_ICON",sep);

    if( (style & 0x30) == LVS_SORTASCENDING )   buildString(s,"??","LVS_SORTASCENDING",sep);
    else if( (style & 0x30) == LVS_SORTDESCENDING ) buildString(s,"??","LVS_SORTDESCENDING",sep);

    if( (style & LVS_ALIGNLEFT) == LVS_ALIGNLEFT )  buildString(s,"??","LVS_ALIGNLEFT",sep);
    if( (style & LVS_NOCOLUMNHEADER) == LVS_NOCOLUMNHEADER )    buildString(s,"??","LVS_NOCOLUMNHEADER",sep);
    if( (style & LVS_NOSORTHEADER) == LVS_NOSORTHEADER )    buildString(s,"??","LVS_NOSORTHEADER",sep);
    if( (style & LVS_AUTOARRANGE) == LVS_AUTOARRANGE )  buildString(s,"??","LVS_AUTOARRANGE",sep);
    if( (style & LVS_EDITLABELS) == LVS_EDITLABELS )    buildString(s,"??","LVS_EDITLABELS",sep);
    if( (style & LVS_NOLABELWRAP) == LVS_NOLABELWRAP )  buildString(s,"??","LVS_NOLABELWRAP",sep);
    if( (style & LVS_NOSCROLL) == LVS_NOSCROLL )    buildString(s,"??","LVS_NOSCROLL",sep);
    if( (style & LVS_OWNERDATA) == LVS_OWNERDATA )  buildString(s,"??","LVS_OWNERDATA",sep);
    if( (style & LVS_OWNERDRAWFIXED) == LVS_OWNERDRAWFIXED )    buildString(s,"??","LVS_OWNERDRAWFIXED",sep);
    if( (style & LVS_SHAREIMAGELISTS) == LVS_SHAREIMAGELISTS )  buildString(s,"??","LVS_SHAREIMAGELISTS",sep);
    if( (style & LVS_SHOWSELALWAYS) == LVS_SHOWSELALWAYS )  buildString(s,"??","LVS_SHOWSELALWAYS",sep);
    if( (style & LVS_SINGLESEL) == LVS_SINGLESEL )  buildString(s,"??","LVS_SINGLESEL",sep);
}

void pushMonthCalendarControlStyle(std::string &s,uint style,const char *sep)
{
    if( (style & MCS_DAYSTATE) == MCS_DAYSTATE )    buildString(s,"??","MCS_DAYSTATE",sep);
    if( (style & MCS_MULTISELECT) == MCS_MULTISELECT )  buildString(s,"??","MCS_MULTISELECT",sep);
    if( (style & MCS_WEEKNUMBERS) == MCS_WEEKNUMBERS )  buildString(s,"??","MCS_WEEKNUMBERS",sep);
    if( (style & MCS_NOTODAYCIRCLE) == MCS_NOTODAYCIRCLE )  buildString(s,"??","MCS_NOTODAYCIRCLE",sep);
    if( (style & MCS_NOTODAY) == MCS_NOTODAY )  buildString(s,"??","MCS_NOTODAY",sep);
}

void pushProgressBarStyle(std::string &s,uint style,const char *sep)
{
    if( (style & PGS_AUTOSCROLL) == PGS_AUTOSCROLL )    buildString(s,"??","PGS_AUTOSCROLL",sep);
    if( (style & PGS_DRAGNDROP) == PGS_DRAGNDROP )  buildString(s,"??","PGS_DRAGNDROP",sep);
    if( (style & PGS_HORZ) == PGS_HORZ )buildString(s,"??","PGS_HORZ",sep);
    if( (style & PGS_VERT) == PGS_VERT )buildString(s,"??","PGS_VERT",sep);
    if( (style & PBS_SMOOTH) == PBS_SMOOTH )    buildString(s,"??","PBS_SMOOTH",sep)
    if( (style & PBS_VERTICAL) == PBS_VERTICAL )    buildString(s,"??","PBS_VERTICAL",sep);
}

void pushReBarStyle(std::string &s,uint style,const char *sep)
{
    if( (style & RBS_AUTOSIZE) == RBS_AUTOSIZE )    buildString(s,"??","RBS_AUTOSIZE",sep);
    if( (style & RBS_BANDBORDERS) == RBS_BANDBORDERS )  buildString(s,"??","RBS_BANDBORDERS",sep);
    if( (style & RBS_DBLCLKTOGGLE) == RBS_DBLCLKTOGGLE )    buildString(s,"??","RBS_DBLCLKTOGGLE",sep);
    if( (style & RBS_FIXEDORDER) == RBS_FIXEDORDER )    buildString(s,"??","RBS_FIXEDORDER",sep);
    if( (style & RBS_REGISTERDROP) == RBS_REGISTERDROP )    buildString(s,"??","RBS_REGISTERDROP",sep);
    if( (style & RBS_TOOLTIPS) == RBS_TOOLTIPS )    buildString(s,"??","RBS_TOOLTIPS",sep);
    if( (style & RBS_VARHEIGHT) == RBS_VARHEIGHT )  buildString(s,"??","RBS_VARHEIGHT",sep);
    if( (style & RBS_VERTICALGRIPPER) == RBS_VERTICALGRIPPER )  buildString(s,"??","RBS_VERTICALGRIPPER",sep);
}

void pushScrollBarStyle(std::string &s,uint style,const char *sep)
{
    if( (style & SBS_VERT) == SBS_VERT )buildString(s,"??","SBS_VERT",sep);
}

void pushStaticControlStyle(std::string &s,uint style,const char *sep)
{
    if( (style & SS_TYPEMASK) == SS_BITMAP )    buildString(s,"??","SS_BITMAP",sep);
    else if( (style & SS_TYPEMASK) == SS_BLACKFRAME )   buildString(s,"??","SS_BLACKFRAME",sep);
    else if( (style & SS_TYPEMASK) == SS_BLACKRECT )    buildString(s,"??","SS_BLACKRECT",sep);
    else if( (style & SS_TYPEMASK) == SS_CENTER )   buildString(s,"??","SS_CENTER",sep);
    else if( (style & SS_TYPEMASK) == SS_ENHMETAFILE )  buildString(s,"??","SS_ENHMETAFILE",sep);
    else if( (style & SS_TYPEMASK) == SS_ETCHEDFRAME )  buildString(s,"??","SS_ETCHEDFRAME",sep);
    else if( (style & SS_TYPEMASK) == SS_ETCHEDHORZ )   buildString(s,"??","SS_ETCHEDHORZ",sep);
    else if( (style & SS_TYPEMASK) == SS_ETCHEDVERT )   buildString(s,"??","SS_ETCHEDVERT",sep);
    else if( (style & SS_TYPEMASK) == SS_GRAYFRAME )    buildString(s,"??","SS_GRAYFRAME",sep);
    else if( (style & SS_TYPEMASK) == SS_GRAYRECT ) buildString(s,"??","SS_GRAYRECT",sep);
    else if( (style & SS_TYPEMASK) == SS_ICON ) buildString(s,"??","SS_ICON",sep);
    else if( (style & SS_TYPEMASK) == SS_LEFTNOWORDWRAP )   buildString(s,"??","SS_LEFTNOWORDWRAP",sep);
    else if( (style & SS_TYPEMASK) == SS_OWNERDRAW )    buildString(s,"??","SS_OWNERDRAW",sep);
    else if( (style & SS_TYPEMASK) == SS_RIGHT )    buildString(s,"??","SS_RIGHT",sep);
    else if( (style & SS_TYPEMASK) == SS_SIMPLE )   buildString(s,"??","SS_SIMPLE",sep);
    else if( (style & SS_TYPEMASK) == SS_WHITEFRAME )   buildString(s,"??","SS_WHITEFRAME",sep);
    else if( (style & SS_TYPEMASK) == SS_WHITERECT )    buildString(s,"??","SS_WHITERECT",sep);

    if( (style & SS_ELLIPSISMASK) == SS_PATHELLIPSIS )  buildString(s,"??","SS_PATHELLIPSIS",sep);
    else if( (style & SS_ELLIPSISMASK) == SS_WORDELLIPSIS ) buildString(s,"??","SS_WORDELLIPSIS",sep);
    else if( (style & SS_ELLIPSISMASK) == SS_ENDELLIPSIS )  buildString(s,"??","SS_ENDELLIPSIS",sep);

    if( (style & SS_CENTERIMAGE) == SS_CENTERIMAGE )    buildString(s,"??","SS_CENTERIMAGE",sep);
    if( (style & SS_NOPREFIX) == SS_NOPREFIX )  buildString(s,"??","SS_NOPREFIX",sep);
    if( (style & SS_NOTIFY) == SS_NOTIFY )  buildString(s,"??","SS_NOTIFY",sep);
    
    if( (style & SS_REALSIZEIMAGE) == SS_REALSIZEIMAGE )    buildString(s,"??","SS_REALSIZEIMAGE",sep);
    if( (style & SS_RIGHTJUST) == SS_RIGHTJUST )    buildString(s,"??","SS_RIGHTJUST",sep);
    if( (style & SS_SUNKEN) == SS_SUNKEN )  buildString(s,"??","SS_SUNKEN",sep);
}

void pushStatusBarStyle(std::string &s,uint style,const char *sep)
{
    if( (style & SBARS_SIZEGRIP) == SBARS_SIZEGRIP )    buildString(s,"??","SBARS_SIZEGRIP",sep);
    if( (style & SBT_TOOLTIPS) == SBT_TOOLTIPS )    buildString(s,"??","SBT_TOOLTIPS",sep);
}

void pushTabBarStyle(std::string &s,uint style,const char *sep)
{
    if( (style & TCS_BOTTOM) == TCS_BOTTOM )    buildString(s,"??","TCS_BOTTOM",sep);
    if( (style & TCS_BUTTONS) == TCS_BUTTONS )  buildString(s,"??","TCS_BUTTONS",sep);
    if( (style & TCS_FIXEDWIDTH) == TCS_FIXEDWIDTH )    buildString(s,"??","TCS_FIXEDWIDTH",sep);
    if( (style & TCS_FLATBUTTONS) == TCS_FLATBUTTONS )  buildString(s,"??","TCS_FLATBUTTONS",sep);
    if( (style & TCS_FOCUSNEVER) == TCS_FOCUSNEVER )    buildString(s,"??","TCS_FOCUSNEVER",sep);
    if( (style & TCS_FOCUSONBUTTONDOWN) == TCS_FOCUSONBUTTONDOWN )  buildString(s,"??","TCS_FOCUSONBUTTONDOWN",sep);
    if( (style & TCS_FORCEICONLEFT) == TCS_FORCEICONLEFT )  buildString(s,"??","TCS_FORCEICONLEFT",sep);
    if( (style & TCS_FORCELABELLEFT) == TCS_FORCELABELLEFT )    buildString(s,"??","TCS_FORCELABELLEFT",sep);
    if( (style & TCS_HOTTRACK) == TCS_HOTTRACK )    buildString(s,"??","TCS_HOTTRACK",sep);
    if( (style & TCS_MULTILINE) == TCS_MULTILINE )  buildString(s,"??","TCS_MULTILINE",sep);
    if( (style & TCS_MULTISELECT) == TCS_MULTISELECT )  buildString(s,"??","TCS_MULTISELECT",sep);
    if( (style & TCS_OWNERDRAWFIXED) == TCS_OWNERDRAWFIXED )    buildString(s,"??","TCS_OWNERDRAWFIXED",sep);
    if( (style & TCS_RAGGEDRIGHT) == TCS_RAGGEDRIGHT )  buildString(s,"??","TCS_RAGGEDRIGHT",sep);
    if( (style & TCS_RIGHT) == TCS_RIGHT )  buildString(s,"??","TCS_RIGHT",sep);
    if( (style & TCS_RIGHTJUSTIFY) == TCS_RIGHTJUSTIFY )    buildString(s,"??","TCS_RIGHTJUSTIFY",sep);
    if( (style & TCS_SCROLLOPPOSITE) == TCS_SCROLLOPPOSITE )    buildString(s,"??","TCS_SCROLLOPPOSITE",sep);
    if( (style & TCS_SINGLELINE) == TCS_SINGLELINE )    buildString(s,"??","TCS_SINGLELINE",sep);
    if( (style & TCS_TABS) == TCS_TABS )buildString(s,"??","TCS_TABS",sep);
    if( (style & TCS_TOOLTIPS) == TCS_TOOLTIPS )    buildString(s,"??","TCS_TOOLTIPS",sep);
    if( (style & TCS_VERTICAL) == TCS_VERTICAL )    buildString(s,"??","TCS_VERTICAL",sep);
}

void pushToolBarStyle(std::string &s,uint style,const char *sep)
{
    if( (style & TBSTYLE_ALTDRAG) == TBSTYLE_ALTDRAG )  buildString(s,"??","TBSTYLE_ALTDRAG",sep);
    if( (style & TBSTYLE_CUSTOMERASE) == TBSTYLE_CUSTOMERASE )  buildString(s,"??","TBSTYLE_CUSTOMERASE",sep);
    if( (style & TBSTYLE_FLAT) == TBSTYLE_FLAT )    buildString(s,"??","TBSTYLE_FLAT",sep);
    if( (style & TBSTYLE_LIST) == TBSTYLE_LIST )    buildString(s,"??","TBSTYLE_LIST",sep);
    if( (style & TBSTYLE_REGISTERDROP) == TBSTYLE_REGISTERDROP )    buildString(s,"??","TBSTYLE_REGISTERDROP",sep);
    if( (style & TBSTYLE_TOOLTIPS) == TBSTYLE_TOOLTIPS )    buildString(s,"??","TBSTYLE_TOOLTIPS",sep);
    if( (style & TBSTYLE_TRANSPARENT) == TBSTYLE_TRANSPARENT )  buildString(s,"??","TBSTYLE_TRANSPARENT",sep);
    if( (style & TBSTYLE_WRAPABLE) == TBSTYLE_WRAPABLE )    buildString(s,"??","TBSTYLE_WRAPABLE",sep);
}

void pushToolTipStyle(std::string &s,uint style,const char *sep)
{
    if( (style & TTS_ALWAYSTIP) == TTS_ALWAYSTIP )  buildString(s,"??","TTS_ALWAYSTIP",sep);
    if( (style & TTS_BALLOON) == TTS_BALLOON )  buildString(s,"??","TTS_BALLOON",sep);
    if( (style & TTS_CLOSE) == TTS_CLOSE )  buildString(s,"??","TTS_CLOSE",sep);
    if( (style & TTS_NOANIMATE) == TTS_NOANIMATE )  buildString(s,"??","TTS_NOANIMATE",sep);
    if( (style & TTS_NOFADE) == TTS_NOFADE )    buildString(s,"??","TTS_NOFADE",sep);
    if( (style & TTS_NOPREFIX) == TTS_NOPREFIX )    buildString(s,"??","TTS_NOPREFIX",sep);
}

void pushTrackBarStyle(std::string &s,uint style,const char *sep)
{
    if( (style & TBS_AUTOTICKS) == TBS_AUTOTICKS )  buildString(s,"??","TBS_AUTOTICKS",sep);
    if( (style & TBS_VERT) == TBS_VERT ) buildString(s,"??","TBS_VERT",sep);
    if( (style & TBS_HORZ) == TBS_HORZ ) buildString(s,"??","TBS_HORZ",sep);
    if( (style & TBS_TOP) == TBS_TOP ) buildString(s,"??","TBS_TOP",sep);
    if( (style & TBS_BOTTOM) == TBS_BOTTOM )    buildString(s,"??","TBS_BOTTOM",sep);
    if( (style & TBS_LEFT) == TBS_LEFT ) buildString(s,"??","TBS_LEFT",sep);
    if( (style & TBS_RIGHT) == TBS_RIGHT ) buildString(s,"??","TBS_RIGHT",sep);
    if( (style & TBS_BOTH) == TBS_BOTH ) buildString(s,"??","TBS_BOTH",sep);
    if( (style & TBS_NOTICKS) == TBS_NOTICKS )  buildString(s,"??","TBS_NOTICKS",sep);
    if( (style & TBS_ENABLESELRANGE) == TBS_ENABLESELRANGE )    buildString(s,"??","TBS_ENABLESELRANGE",sep);
    if( (style & TBS_FIXEDLENGTH) == TBS_FIXEDLENGTH )  buildString(s,"??","TBS_FIXEDLENGTH",sep);
    if( (style & TBS_NOTHUMB) == TBS_NOTHUMB )  buildString(s,"??","TBS_NOTHUMB",sep);
    if( (style & TBS_TOOLTIPS) == TBS_TOOLTIPS )    buildString(s,"??","TBS_TOOLTIPS",sep);
    if( (style & TBS_REVERSED) == TBS_REVERSED )    buildString(s,"??","TBS_REVERSED",sep);
    if( (style & TBS_DOWNISLEFT) == TBS_DOWNISLEFT )    buildString(s,"??","TBS_DOWNISLEFT",sep);
}

void pushTreeViewStyle(std::string &s,uint style,const char *sep)
{
    if( (style & TVS_CHECKBOXES) == TVS_CHECKBOXES )    buildString(s,"??","TVS_CHECKBOXES",sep);
    if( (style & TVS_DISABLEDRAGDROP) == TVS_DISABLEDRAGDROP )  buildString(s,"??","TVS_DISABLEDRAGDROP",sep);
    if( (style & TVS_EDITLABELS) == TVS_EDITLABELS )    buildString(s,"??","TVS_EDITLABELS",sep);
    if( (style & TVS_FULLROWSELECT) == TVS_FULLROWSELECT )  buildString(s,"??","TVS_FULLROWSELECT",sep);
    if( (style & TVS_HASBUTTONS) == TVS_HASBUTTONS )    buildString(s,"??","TVS_HASBUTTONS",sep);
    if( (style & TVS_HASLINES) == TVS_HASLINES )    buildString(s,"??","TVS_HASLINES",sep);
    if( (style & TVS_INFOTIP) == TVS_INFOTIP )  buildString(s,"??","TVS_INFOTIP",sep);
    if( (style & TVS_LINESATROOT) == TVS_LINESATROOT )  buildString(s,"??","TVS_LINESATROOT",sep);
    if( (style & TVS_NOHSCROLL) == TVS_NOHSCROLL )  buildString(s,"??","TVS_NOHSCROLL",sep);
    if( (style & TVS_NONEVENHEIGHT) == TVS_NONEVENHEIGHT )  buildString(s,"??","TVS_NONEVENHEIGHT",sep);
    if( (style & TVS_NOSCROLL) == TVS_NOSCROLL )    buildString(s,"??","TVS_NOSCROLL",sep);
    if( (style & TVS_NOTOOLTIPS) == TVS_NOTOOLTIPS )    buildString(s,"??","TVS_NOTOOLTIPS",sep);
    if( (style & TVS_RTLREADING) == TVS_RTLREADING )    buildString(s,"??","TVS_RTLREADING",sep);
    if( (style & TVS_SHOWSELALWAYS) == TVS_SHOWSELALWAYS )  buildString(s,"??","TVS_SHOWSELALWAYS",sep);
    if( (style & TVS_SINGLEEXPAND) == TVS_SINGLEEXPAND )    buildString(s,"??","TVS_SINGLEEXPAND",sep);
}

void pushUpDownControlStyle(std::string &s,uint style,const char *sep)
{
    if( (style & UDS_ALIGNLEFT) == UDS_ALIGNLEFT )  buildString(s,"??","UDS_ALIGNLEFT",sep);
    else if( (style & UDS_ALIGNRIGHT) == UDS_ALIGNRIGHT )   buildString(s,"??","UDS_ALIGNRIGHT",sep);

    if( (style & UDS_ARROWKEYS) == UDS_ARROWKEYS )  buildString(s,"??","UDS_ARROWKEYS",sep);
    if( (style & UDS_AUTOBUDDY) == UDS_AUTOBUDDY )  buildString(s,"??","UDS_AUTOBUDDY",sep);
    if( (style & UDS_HORZ) == UDS_HORZ ) buildString(s,"??","UDS_HORZ",sep);
    if( (style & UDS_HOTTRACK) == UDS_HOTTRACK )    buildString(s,"??","UDS_HOTTRACK",sep);
    if( (style & UDS_NOTHOUSANDS) == UDS_NOTHOUSANDS )  buildString(s,"??","UDS_NOTHOUSANDS",sep);
    if( (style & UDS_SETBUDDYINT) == UDS_SETBUDDYINT )  buildString(s,"??","UDS_SETBUDDYINT",sep);
    if( (style & UDS_WRAP) == UDS_WRAP ) buildString(s,"??","UDS_WRAP",sep);
}

Win32ClassList win32_class_list =
{
 {ANIMATE_CLASSA, pushAnimateControlStyle},
 {WC_BUTTONA, pushButtonStyle,},
 {WC_COMBOBOXEXA, pushComboBoxExStyle},
 {WC_COMBOBOXA, pushComboBoxStyle},
 {DATETIMEPICK_CLASSA, pushDateTimePickerStyle},
 {WC_EDITA, pushEditControlStyle},
 {WC_HEADERA, pushHeaderControlStyle},
 {WC_LISTBOXA, pushListBoxStyle},
 {WC_LISTVIEWA, pushListViewStyle},
 {MONTHCAL_CLASSA, pushMonthCalendarControlStyle},
 {PROGRESS_CLASSA, pushProgressBarStyle},
 {REBARCLASSNAMEA, pushReBarStyle},
 {WC_SCROLLBARA, pushScrollBarStyle},
 {WC_STATICA, pushStaticControlStyle},
 {STATUSCLASSNAMEA, pushStatusBarStyle},
 {WC_TABCONTROLA, pushTabBarStyle},
 {TOOLBARCLASSNAMEA, pushToolBarStyle},
 {TOOLTIPS_CLASSA, pushToolTipStyle},
 {TRACKBAR_CLASSA, pushTrackBarStyle},
 {WC_TREEVIEWA, pushTreeViewStyle},
 {UPDOWN_CLASSA,pushUpDownControlStyle},
};

}
于 2021-11-28T20:02:36.780 回答