2个回答
展开全部
#define IDM_SAVE 111 //定义两个常数
#define IDM_CLOSE 112
************************************
HWND m_hWnd = CreateWindow("Window", "测试窗口", WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);
if(!m_hWnd) return FALSE;
HMENU hMenu=CreateMenu();
HMENU hPMenu=CreateMenu();
AppendMenu(hPMenu, MF_STRING, IDM_SAVE, "保存");
AppendMenu(hPMenu, MF_STRING, IDM_CLOSE,"关闭");
AppendMenu(hMenu, MF_POPUP, (LONG)hPMenu, "文件") ;
SetMenu(m_hWnd,hMenu);
ShowWindow(m_hWnd, nCmdShow);
UpdateWindow(m_hWnd);
return TRUE;
#define IDM_CLOSE 112
************************************
HWND m_hWnd = CreateWindow("Window", "测试窗口", WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);
if(!m_hWnd) return FALSE;
HMENU hMenu=CreateMenu();
HMENU hPMenu=CreateMenu();
AppendMenu(hPMenu, MF_STRING, IDM_SAVE, "保存");
AppendMenu(hPMenu, MF_STRING, IDM_CLOSE,"关闭");
AppendMenu(hMenu, MF_POPUP, (LONG)hPMenu, "文件") ;
SetMenu(m_hWnd,hMenu);
ShowWindow(m_hWnd, nCmdShow);
UpdateWindow(m_hWnd);
return TRUE;
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询