春暖花开
雪化了,花开了,春天来了
posts - 149,comments - 125,trackbacks - 0

在windows mobile 上如何修改菜单上的文字呢?
我原先也只是看别人的代码,然后copy过来自己用,有的时候弄不清楚所以然,就会出错。
通过下面的方法,我们可以修改菜单上的文字:

1HMENU hMenu=NULL;
2    TBBUTTONINFO tbbi = {0};
3    tbbi.cbSize = sizeof(tbbi);
4    tbbi.dwMask = TBIF_LPARAM | TBIF_BYINDEX;
5    SendMessage(hMenuHWND, TB_GETBUTTONINFO, 1, (LPARAM)&tbbi); //修改菜单项 在左边为0,在右边为1      
6    hMenu = (HMENU)tbbi.lParam;
7    
8    InsertMenu(hMenu,beforeItem,MF_BYCOMMAND,afterItem,sText);    //加入含有欲改写文本的菜单项
9    DeleteMenu(hMenu,beforeItem,MF_BYCOMMAND);    //删除被改写的菜单

通过上面的方法,我们就能修改菜单上的文字。

此外,学习一下TB_GETBUTTONINFO
消息:TB_GETBUTTONINFO
作用:This message retrieves the information for a button in a toolbar.
使用:wParam = (WPARAM)(INT) iID;
            lParam = (LPARAM)(LPTBBUTTONINFO) lptbbi;
参数介绍:
     iID  Button identifier.
     lptbbi Long pointer to a TBBUTTONINFO structure that receives the button information. The cbSize and dwMask members of this structure must be filled in prior to sending this message.
 
posted on 2008-07-30 18:41 Sandy 阅读(899) 评论(0)  编辑 收藏 引用

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理