虽然问题幼稚但很急,请问我要动态的添加两极菜单

html007 2000-07-19 06:38:00
加精
虽然问题幼稚但很急,请问我要动态的添加两极菜单,那么我一级菜单的属性怎样设,才能使二级菜单加上。急!!!!!!!!
...全文
219 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
html007 2000-07-21
  • 打赏
  • 举报
回复
endlessway非常感谢您的热心帮忙!!我的问题解决了。
endlessway 2000-07-21
  • 打赏
  • 举报
回复
最主要的是第一个参数若是MF_POPUP,则第二个参数是一个菜单的HMENU句柄,用int转换一下
pPopmenu->AppendMenu(MF_POPUP,(int)x->m_hMenu,"popup");
endlessway 2000-07-21
  • 打赏
  • 举报
回复
CMenu Popmenu;
Popmenu.LoadMenu(IDR_MAINMENU);//主菜单
添加popup菜单的方法:
CMenu Popmenu;
Popmenu.LoadMenu(IDR_MAINMENU);//主菜单
CMenu popmenu2;
popmenu2.LoadMenu(IDR_MENU1);//将要添加的popup菜单,此处是从资源得到,可以在程序中自己CreateMenu
CMenu *x=popmenu2.GetSubMenu(0);
CMenu* pPopmenu= Popmenu.GetSubMenu(0);//一级菜单
pPopmenu->AppendMenu(MF_POPUP,(int)x->m_hMenu,"popup");
pPopmenu->TrackPopupMenu(TPM_LEFTALIGN ,100,100,AfxGetMainWnd(),NULL);
endlessway 2000-07-21
  • 打赏
  • 举报
回复
添加popup菜单的方法:
CMenu Popmenu;
Popmenu.LoadMenu(IDR_MAINMENU);//主菜单
CMenu popmenu2;
popmenu2.LoadMenu(IDR_MENU1);//将要添加的popup菜单,此处是从资源得到,可以在程序中自己CreateMenu
CMenu *x=popmenu2.GetSubMenu(0);
CMenu* pPopmenu= Popmenu.GetSubMenu(0);//一级菜单
pPopmenu->AppendMenu(MF_POPUP,(int)x->m_hMenu,"popup");
pPopmenu->TrackPopupMenu(TPM_LEFTALIGN ,100,100,AfxGetMainWnd(),NULL);
html007 2000-07-20
  • 打赏
  • 举报
回复
endlessway你说得很对,我的程序如下请指点
Popmenu.LoadMenu(IDR_MAINMENU);//主菜单
CMenu* pPopmenu= Popmenu.GetSubMenu(0);//一级菜单
pPopmenu->InsertMenu(0,MF_POPUP,123,(pNewsType+i)->NewsType); ///加条目
CMenu* w=pPopmenu->GetSubMenu(0)->GetSubMenu(0);//得不到下级菜单了
endlessway 2000-07-20
  • 打赏
  • 举报
回复
在将菜单的pop-up属性选择后,必须为这个popup菜单添加至少一个子菜单
例如: RecentFile->NoRecentFile RecentFile是popup菜单,NoRecentFile只是添加,不做处理,以后添加了菜单,可以再将NoRecentFile删除,但必须至少有一个子菜单
// MenuBar 一级菜单 二级菜单
CMenu *pMenu=AfxGetMainWnd()->GetMenu()->GetSubMenu(4)->GetSubMenu(3);
pMenu->AppendMenu(MF_STRING,60000,"New MenuItem1");
html007 2000-07-20
  • 打赏
  • 举报
回复
不管用,那位有demo程序?????????????
endlessway 2000-07-19
  • 打赏
  • 举报
回复
pop-up属性选择上就可以增加二级菜单
WHQ 2000-07-19
  • 打赏
  • 举报
回复
用AppendMenu
The AppendMenu function appends a new item to the end of the specified menu bar, drop-down menu, submenu, or shortcut menu. You can use this function to specify the content, appearance, and behavior of the menu item.

The AppendMenu function has been superseded by the InsertMenuItem function. You can still use AppendMenu, however, if you do not need any of the extended features of InsertMenuItem.

BOOL AppendMenu(

HMENU hMenu, // handle to menu to be changed
UINT uFlags, // menu-item flags
UINT uIDNewItem, // menu-item identifier or handle of drop-down menu or submenu
LPCTSTR lpNewItem // menu-item content
);


Parameters

hMenu

Identifies the menu bar, drop-down menu, submenu, or shortcut menu to be changed.

uFlags

Specifies flags to control the appearance and behavior of the new menu item. This parameter can be a combination of the values listed in the following Remarks section.

uIDNewItem

Specifies either the identifier of the new menu item or, if the uFlags parameter is set to MF_POPUP, the handle to the drop-down menu or submenu.

lpNewItem

Specifies the content of the new menu item. The interpretation of lpNewItem depends on whether the uFlags parameter includes the MF_BITMAP, MF_OWNERDRAW, or MF_STRING flag, as follows:

Value Description
MF_BITMAP Contains a bitmap handle.
MF_OWNERDRAW Contains a 32-bit value supplied by the application that can be used to maintain additional data related to the menu item. The value is in the itemData member of the structure pointed to by the lparam parameter of the WM_MEASURE or WM_DRAWITEM message sent when the menu is created or its appearance is updated.
MF_STRING Contains a pointer to a null-terminated string.


Return Values

If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

The application must call the DrawMenuBar function whenever a menu changes, whether or not the menu is in a displayed window.
The following flags can be set in the uFlags parameter:

Value Description
MF_BITMAP Uses a bitmap as the menu item. The lpNewItem parameter contains the handle to the bitmap.
MF_CHECKED Places a check mark next to the menu item. If the application provides check-mark bitmaps (see SetMenuItemBitmaps), this flag displays the check mark bitmap next to the menu item.
MF_DISABLED Disables the menu item so it cannot be selected, but the flag does not gray it.
MF_ENABLED Enables the menu item so it can be selected, and restores it from its grayed state.
MF_GRAYED Disables the menu item and grays it so it cannot be selected.
MF_MENUBARBREAK Functions the same as the MF_MENUBREAK flag for a menu bar. For a drop-down menu, submenu, or shortcut menu, the new column is separated from the old column by a vertical line.
MF_MENUBREAK Places the item on a new line (for a menu bar) or in a new column (for a drop-down menu, submenu, or shortcut menu) without separating columns.
MF_OWNERDRAW Specifies that the item is an owner-drawn item. Before the menu is displayed for the first time, the window that owns the menu receives a WM_MEASUREITEM message to retrieve the width and height of the menu item. The WM_DRAWITEM message is then sent to the window procedure of the owner window whenever the appearance of the menu item must be updated.
MF_POPUP Specifies that the menu item opens a drop-down menu or submenu. The uIDNewItem parameter specifies the handle to the drop-down menu or submenu. This flag is used to add a menu name to a menu bar, or a menu item that opens a submenu to a drop-down menu, submenu, or shortcut menu.
MF_SEPARATOR Draws a horizontal dividing line. This flag is used only in a drop-down menu, submenu, or shortcut menu. The line cannot be grayed, disabled, or highlighted. The lpNewItem and uIDNewItem parameters are ignored.
MF_STRING Specifies that the menu item is a text string; the lpNewItem parameter points to the string.
MF_UNCHECKED Does not place a check mark next to the item (default). If the application supplies check-mark bitmaps (see SetMenuItemBitmaps), this flag displays the unchecked bitmap next to the menu item.


The following groups of flags cannot be used together:

?MF_DISABLED, MF_ENABLED, and MF_GRAYED
?MF_BITMAP, MF_STRING, and MF_OWNERDRAW
?MF_MENUBARBREAK and MF_MENUBREAK
?MF_CHECKED and MF_UNCHECKED

2008年爆发全球金融危机,同年11月1日,一个自称中本聪(Satoshi Nakamoto)的人在P2P foundation网站上发布了比特币白皮书《比特币:一种点对点的电子现金系统》 [6]  ,陈述了他对电子货币的新设想——比特币就此面世。2009年1月3日,比特币创世区块诞生。 和法定货币相比,比特币没有一个集中的发行方,而是由网络节点的计算生成,谁都有可能参与制造比特币,而且可以全世界流通,可以在任意一台接入互联网的电脑上买卖,不管身处何方,任何人都可以挖掘、购买、出售或收取比特币,并且在交易过程中外人无法辨认用户身份信息。2009年1月5日,不受央行和任何金融机构控制的比特币诞生。比特币是一种数字货币,由计算机生成的一串串复杂代码组成,新比特币通过预设的程序制造。 每当比特币进入主流媒体的视野时,主流媒体总会请一些主流经济学家分析一下比特币。早先,这些分析总是集中在比特币是不是骗局。而现如今的分析总是集中在比特币能否成为未来的主流货币。而这其中争论的焦点又往往集中在比特币的通缩特性上。 [7]  不少比特币玩家是被比特币的不能随意增发所吸引的。和比特币玩家的态度截然相反,经济学家们对比特币2100万固定总量的态度两极分化。 凯恩斯学派的经济学家们认为政府应该积极调控货币总量,用货币政策的松紧来为经济适时的加油或者刹车。因此,他们认为比特币固定总量货币牺牲了可调控性,而且更糟糕的是将不可避免地导致通货紧缩,进而伤害整体经济。奥地利学派经济学家们的观点却截然相反,他们认为政府对货币的干预越少越好,货币总量的固定导致的通缩并没什么大不了的,甚至是社会进步的标志。 比特币网络通过“挖矿”来生成新的比特币。所谓“挖矿”实质上是用计算机解决一项复杂的数学问题,来保证比特币网络分布式记账系统的一致性。比特币网络会自动调整数学问题的难度,让整个网络约每10分钟得到一个合格答案。随后比特币网络会新生成一定量的比特币作为区块奖励,奖励获得答案的人。 [6]  2009年,比特币诞生的时候,区块奖励是50个比特币。诞生10分钟后,第一批50个比特币生成了,而此时的货币总量就是50。随后比特币就以约每10分钟50个的速度增长。当总量达到1050万时(2100万的50%),区块奖励减半为25个。当总量达到1575万(新产出525万,即1050的50%)时,区块奖励再减半为12.5个。该货币系统曾在4年内只有不超过1050万个,之后的总数量将被永久限制在约2100万个。 [3]  [8]  比特币是一种虚拟货币,数量有限,但是可以用来套现:可以兑换成大多数国家的货币。你可以使用比特币购买一些虚拟的物品,比如网络游戏当中的衣服、帽子、装备等,只要有人接受,你也可以使用比特币购买现实生活当中的物品。 2014年2月25日,“比特币中国”的比特币开盘价格为3562.41元,截至下午4点40分,价格已下跌至3185元,跌幅逾10%。根据该平台的历史行情数据显示,在2014年1月27日,1比特币还能兑换5032元人民币。这意味着,该平台上不到一个月,比特币价格已下跌了36.7%。 同年9月9日,美国电商巨头eBay宣布,该公司旗下支付处理子公司Braintree将开始接受比特币支付。该公司已与比特币交易平台Coinbase达成合作,开始接受这种相对较新的支付手段。 虽然eBay市场交易平台和PayPal业务还不接受比特币支付,但旅行房屋租赁社区Airbnb和租车服务Uber等Braintree客户将可开始接受这种虚拟货币。Braintree的主要业务是面向企业提供支付处理软件,该公司在2013年被eBay以大约8亿美元的价格收购。 2017年1月22日晚间,火币网、比特币中国与OKCoin币行相继在各自官网发布公告称,为进一步抑制投机,防止价格剧烈波动,各平台将于1月24日中午12:00起开始收取交易服务费,服务费按成交金额的0.2%固定费率收取,且主动成交和被动成交费率一致。 [9]  5月5日,OKCoin币行网的新数据显示,比特币的价格刚刚再度刷新历史,截止发稿前高触及9222元人民币高位。1月24日中午12:00起,中国三大比特币平台正式开始收取交易费。9月4日,央行等七部委发公告称中国禁止虚拟货币交易。同年12月17日,比特币达到历史高价19850美元。 2018年11月25日,比特币跌破4000美元大关,后稳定在3000多美元。 [10]  11月19日,加密货币恢复跌势,比特币自2017年10月以来首次下探5000美元大关,原因是之前BCH出现硬分叉,且监管部门对首次代币发行(ICO)加强了审查。 [10]  11月21日凌晨4点半,coinbase平台比特币报价跌破4100美元,创下了13个月以来的新低。 2019年4月,比特币再次突破5000美元大关,创年内新高。 [11]  5月12日,比特币近八个月来首次突破7000美元。 [12]  5月14日,据coinmarketcap报价显示,比特币站上8000美元,24小时内上涨14.68%。 [13]  6月22日 ,比特币价格突破10000美元大关。比特币价格在10200左右震荡,24小时涨幅近7%。 [14]  6月26日,比特币价格一举突破12000美元,创下自去年1月来近17个月高点。 [15]  6月27日早间,比特币价格一度接近14000美元,再创年内新高。 [16]  2020年2月10日,比特币突破了一万美元。据交易数据,比特币的价格涨幅突破3% [17]  。3月12日,据加密货币交易平台Bitstamp数据显示,19点44分,比特币低价格已跌至5731美元 [18]  。5月8日,比特币突破10000美元关口,创下2月份以来的新高 [19]  。5月10日早上8点开始,比特币单价在半小时内从9500美元价位瞬间下跌了上千美元,低价格跌破8200美元,高价差超1400美元 [20]  。7月26日下午6点,比特币短时极速拉升,高触及10150.15USDT,日内大涨幅超过4%,这是2020年6月2日以来首次突破1万美元关口 [21]  。11月4日,比特币价格正式突破14000美元 [22]  。11月12日晚,比特币价格突破16000美元,刷新2018年1月以来新高,一周涨超8.6%。比特币总市值突破2915亿美元 [23]  。11月18日,比特币价格突破17000美元 [24]  。12月1日,比特币价格报19455.31美元,24小时涨幅为5.05%。 [25]  12月17日,比特币价格突破23000美元整数关口,刷新历史新高,日内涨幅超7.5%。 [26]  截至12月27日19时20分,比特币报价28273.06美元。 [27]  2021年1月8日,比特币涨至4万美元关口上方,高至40402美元

16,471

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Web++
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧