勾选和不勾选菜单的解决方案

DWORD WINAPI CheckMenuItem(
  _In_ HMENU hmenu,      // 菜单句柄
  _In_ UINT  uIDCheckItem,  // 菜单项ID或菜单项位置(索引)
  _In_ UINT  uCheck   // menu item options
);
注意需要在AppendMenu中指定MF_CHECKED风格


menu item options:




MF_CHECKED   勾选
0x00000008L Sets the check-mark attribute to the selected state.
 
MF_UNCHECKED 非勾选
0x00000000L Sets the check-mark attribute to the clear state.


MF_BYCOMMAND  第二个给菜单项的ID 
0x00000000L Indicates that the uIDCheckItem parameter gives the identifier of the menu item. The MF_BYCOMMAND flag is the default, if neither the MF_BYCOMMAND nor MF_BYPOSITION flag is specified.
 
MF_BYPOSITION  第二个参数给菜单项索引


 



你可能感兴趣的:(PC桌面应用)