// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);一个程序里的2行代码。。看不明白。。
请教:IDM_ABOUTBOX & 0xFFF0 是什么啊?为什么IDM_ABOUTBOX要小于0xF000呀?
谢谢!

解决方案 »

  1.   

    IDM_ABOUTBOX & 0xFFF0  是屏蔽IDM_ABOUTBOX的最后四位(设为0)。((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX)就是判断IDM_ABOUTBOX的最低四位是否为0。
    至于为什么要在这个范围内,可能判断是否处于系统命令范围的吧。这个不太清楚。等高手来答吧
      

  2.   

    In WM_SYSCOMMAND messages, the four low-order bits of the nID parameter are used internally by Windows. When an application tests the value of nID, it must combine the value 0xFFF0 with the nID value by using the bitwise-AND operator to obtain the correct result.下面是系统定义的命令:
    #define SC_SIZE         0xF000
    #define SC_MOVE         0xF010
    #define SC_MINIMIZE     0xF020
    #define SC_MAXIMIZE     0xF030
    #define SC_NEXTWINDOW   0xF040
    #define SC_PREVWINDOW   0xF050
    #define SC_CLOSE        0xF060
    #define SC_VSCROLL      0xF070
    #define SC_HSCROLL      0xF080
    #define SC_MOUSEMENU    0xF090
    #define SC_KEYMENU      0xF100
    #define SC_ARRANGE      0xF110
    #define SC_RESTORE      0xF120
    #define SC_TASKLIST     0xF130
    #define SC_SCREENSAVE   0xF140
    #define SC_HOTKEY       0xF150
    #if(WINVER >= 0x0400)
    #define SC_DEFAULT      0xF160
    #define SC_MONITORPOWER 0xF170
    #define SC_CONTEXTHELP  0xF180
    #define SC_SEPARATOR    0xF00F