C++ AppendMenu
|
主题 |
|
1. 系统菜单下面添加自定义菜单 2. 3. 4. 5. |
|
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. Note 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 UINT uFlags,
// menu-item options UINT_PTR uIDNewItem, // identifier, menu, or submenu
LPCTSTR lpNewItem // menu-item content
);
|
|
ID |
Value |
Description |
|
1. |
MF_BITMAP |
位图 |
|
2. |
MF_DISABLED |
不可用 |
|
3. |
MF_ENABLED |
可用 |
|
4. |
MF_GRAYED |
灰色 |
|
5. |
MF_MENUBARBREAK |
|
|
6. |
MF_MENUBREAK |
|
|
7. |
MF_OWNERDRAW |
|
|
8. |
MF_POPUP |
|
|
9. |
MF_SEPARATOR |
分隔符号 |
|
10. |
MF_STRING |
字符串 |
|
11. |
MF_CHECKED |
勾上 |
|
12. |
MF_UNCHECKED |
取消勾上 |
|
代码::系统菜单下面添加自定义菜单 |
|
1.在Resource.h里面 #define ID_MENU1 0x1500
2.在::OnInitDialog() 下面添加代码
// TODO: Add extra initialization here
CMenu* pMenu = GetSystemMenu(FALSE);
CString menu1="新菜单";
pMenu->AppendMenu(MF_SEPARATOR);
pMenu->AppendMenu(MF_STRING, ID_MENU1, menu1);
3.在::OnSysCommand(UINT nID, LPARAM lParam) 下面添加响应单击 这个菜单的代码
void CProject02Dlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) ==
IDM_ABOUTBOX) {
CAboutDlg dlgAbout; dlgAbout.DoModal(); }
else if
(nID==ID_MENU1) {
MessageBox("YES"); }
else
{
CDialog::OnSysCommand(nID, lParam); }
} 效果图:
|
|
ID |
nID |
备注:OnSysCommand |
|
1. |
SC_CLOSE |
Close |
|
2. |
SC_MAXIMIZE |
(or |
|
3. |
SC_MINIMIZE |
(or |
|
4. |
SC_MOVE |
Move |
|
5. |
SC_RESTORE |
Restore |
|
6. |
SC_SIZE |
Size |
|
7. |
SC_NEXTWINDOW |
Move |
|
8. |
SC_PREVWINDOW |
Move |
|
9. |
SC_KEYMENU |
Retrieve |
|
10. |
SC_MOUSEMENU |
Retrieve |
|
11. |
SC_HOTKEY |
Activate |
|
12. |
The |
|
|
13. |
SC_SCREENSAVE |
Executes |
|
14. |
SC_TASKLIST |
Execute |
|
15. |
SC_VSCROLL |
Scroll |
|
16. |
SC_HSCROLL |
Scroll |

C++ AppendMenu的更多相关文章
- AppendMenu函数添加菜单
这个函数添加新项目到指定菜单的末尾.你可以使用appendmenu指定内容,外观,和菜单项行为. BOOL AppendMenu( HMENU hMenu, UINT uFlags, UINT uID ...
- C++ 最小化到托盘
#define WM_SHOWTASK (WM_USER + 1) void CTestDlg::OnSysCommand(UINT nID, LPARAM lParam) { if ((nID &a ...
- Windows API 函数列表 附帮助手册
所有Windows API函数列表,为了方便查询,也为了大家查找,所以整理一下贡献出来了. 帮助手册:700多个Windows API的函数手册 免费下载 API之网络函数 API之消息函数 API之 ...
- windows消息机制详解(转载)
消息,就是指Windows发出的一个通知,告诉应用程序某个事情发生了.例如,单击鼠标.改变窗口尺寸.按下键盘上的一个键都会使Windows发送一个消息给应用程序.消息本身是作为一个记录传递给应用程序的 ...
- WIN 下的超动态菜单(三)代码
WIN 下的超动态菜单(一)简介 WIN 下的超动态菜单(二)用法 WIN 下的超动态菜单(三)代码 作者:黄山松,发表于博客园:http://www.cnblogs.com/tomview/ 超动态 ...
- 【Windows编程】系列第十一篇:多文档界面框架
前面我们所举的例子中都是单文档界面框架,也就是说这个窗口里面的客户区就是一个文档界面,可以编写程序在里面输入或者绘制文本和图形输出,但是不能有出现多个文档的情况.比如下面的UltraEdit就是一个典 ...
- 【Windows编程】系列第七篇:Menubar的创建和使用
上一篇我们学习了利用windows API创建工具栏和菜单栏,与上一篇紧密联系的就是菜单栏,菜单栏是一个大多数复杂一些的Windows应用程序不可或缺的部分.比如下图就是Windows自带的记事本的菜 ...
- Microsoft Win32 to Microsoft .NET Framework API Map
Microsoft Win32 to Microsoft .NET Framework API Map .NET Development (General) Technical Articles ...
- C#封装好的Win32API
Kernel.cs using System; using System.Runtime.InteropServices; using System.Text; using HANDLE = Syst ...
随机推荐
- iOS - GIF图的完美拆解、合成、显示
转:http://blog.csdn.net/marujunyy/article/details/14455699 最近由于项目需要,需要先把gif图拆解开,然后在每一张图片上添加一些图片和文字,最后 ...
- POJ2987 Firing 最大权闭合图
详情请参考http://www.cnblogs.com/kane0526/archive/2013/04/05/3001557.html 值得注意的地方,割边会把图分成两部分,一部分和起点相连,另一部 ...
- "_ITERATOR_DEBUG_LEVEL"的不匹配项: 值"0"不匹配值"2"
error: 1>vtkCommon.lib(vtkDebugLeaksManager.obj) : error LNK2038: 检测到“_ITERATOR_DEBUG_LEVEL”的不匹配项 ...
- XShell 屏幕锁定的恢复方法(Ctrl+Q)
操作XShell过程中很多时间大家会习惯性的按Ctrl+S进行保存. Ctrl+S在XShell的作用是屏幕锁定,很多朋友会无法操作,会直接把窗口关闭. 解决方法: 快捷键 Ctrl+Q 即能完成解锁 ...
- jQuery遍历Table tr td td中包含标签
function shengchen() { var arrTR = $("#tbModule").children(); var Context=""; $( ...
- redo文件二
为什么要引入LGWR后台进程和redo log buffer 如果使用前台进程来将redo的信息写入到redo日志文件组中,那么会导致并发的前台进程对redo日志文件组的争用,从而使用后台进程LGWR ...
- matlab中的字符串数组与函数调用
1, matlab中的字符串就是1维字符数组,即如: a = 'dddssd'; b = 'lsde'; c = [a, b]; 当然也可以: c= strcat(a, b); 2, matlab中的 ...
- homework-05 GoldNumberServer
作业要求 这次作业要求实现一个黄金数游戏服务器,游戏流程如下,每个client向服务器提交一个有理数,服务器接收到所有客户端的提交后计算这些数字的平均数,再将其乘以黄金分割得到一个GoldNumber ...
- Codeforces 599D Spongebob and Squares(数学)
D. Spongebob and Squares Spongebob is already tired trying to reason his weird actions and calculati ...
- Codeforces 622B The Time 【水题】
B. The Time time limit per test 1 second memory limit per test 256 megabytes input standard input ou ...
