使用InsertMenuItem()编辑系统菜单无法正常工作 [英] Editing system menu using InsertMenuItem() not working correctly

查看:168
本文介绍了使用InsertMenuItem()编辑系统菜单无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在系统菜单的第二个位置添加一个关于菜单项,但它最后显示!



  HMENU hSystemMenu = GetSystemMenu(hWnd,FALSE); 

MENUITEMINFO mii_system;
mii_system.cbSize = sizeof(MENUITEMINFO);
mii_system.fMask = MIIM_STRING | MIIM_ID;
mii_system.wID = 1005;
mii_system.dwTypeData =About;

InsertMenuItem(hSystemMenu,1,FALSE,& mii_system);


解决方案

  BOOL WINAPI InsertMenuItem(
_In_ HMENU hMenu,
_In_ UINT uItem,
_In_ BOOL fByPosition,
_In_ LPCMENUITEMINFO lpmii
);

fByPosition [in]
类型:BOOL

uItem的意思。如果此参数为FALSE,uItem是菜单项标识符。否则,它是一个菜单项位置。



我猜你想要位置1,而不是项目ID 1.在这种情况下,你会希望这是TRUE。


I am trying to add an "About" menu item in the second place of the system menu, but it's showing up last!

HMENU hSystemMenu = GetSystemMenu(hWnd, FALSE);

MENUITEMINFO mii_system;
mii_system.cbSize = sizeof(MENUITEMINFO);
mii_system.fMask = MIIM_STRING | MIIM_ID;
mii_system.wID = 1005;
mii_system.dwTypeData = "About";

InsertMenuItem(hSystemMenu, 1, FALSE, &mii_system);

解决方案

BOOL WINAPI InsertMenuItem(
  _In_  HMENU hMenu,
  _In_  UINT uItem,
  _In_  BOOL fByPosition,
  _In_  LPCMENUITEMINFO lpmii
);

fByPosition [in]
Type: BOOL

Controls the meaning of uItem. If this parameter is FALSE, uItem is a menu item identifier. Otherwise, it is a menu item position.

I'm guessing you want position 1, not item ID 1. In that case, you would want this to be TRUE.

这篇关于使用InsertMenuItem()编辑系统菜单无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆