假设现在nodepad正在运行,已得到其窗体句柄,如何得知其主菜单是不是灰色的?查一些资料好像要用getmenustate,但讲的都不很清楚,请给一些代码谢谢。

解决方案 »

  1.   

    直接用就是了
    getmenustate有返回值,如下
    返回值         描述
    MF_CHECKED Places a check  next to the item (for drop-down menus, submenus, and shortcut menus only). 
    MF_DISABLED Disables the item. 
    MF_GRAYED 灰掉. 
    MF_HILITE Highlights the item. 
    MF_MENUBARBREAK Functions the same as the MF_MENUBREAK flag, except for drop-down menus, submenus, and shortcut menus, where the new column is separated from the old column by a vertical line. 
    MF_MENUBREAK Places the item on a new line (for menu bars) or in a new column (for drop-down menus, submenus, and shortcut menus) without separating columns. 
    MF_SEPARATOR
      

  2.   

    bdmh:你说的这个方法针对同一进程内的程序管用,但对于外部程序不同进程单纯的使用getmenustate返回值是不正确的,我也是遇到这个问题,正在解决中