zoukankan      html  css  js  c++  java
  • [WTL] 系统菜单中加入新项

    1.在OnInitDialog中加入:  
    // IDM_ABOUTBOX must be in the system command range.
      ATLASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
      ATLASSERT(IDM_ABOUTBOX < 0xF000);

      HMENU hMenu = GetSystemMenu(FALSE);
      CMenu sysMenu(hMenu);
      if (sysMenu.m_hMenu != NULL)
      {
       CString strAboutMenu;
       strAboutMenu.LoadString(IDS_ABOUTBOX);
       if (!strAboutMenu.IsEmpty())
       {
        sysMenu.AppendMenu(MF_SEPARATOR);
        sysMenu.AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
       }
      }

    2.加入消息响应:
    (1)  MSG_WM_SYSCOMMAND(OnSysCommand)
    (2)
     void OnSysCommand( UINT nID, CPoint point)
     {
      if ((nID & 0xFFF0) == IDM_ABOUTBOX)
      {
       CAboutDlg dlgAbout;
       dlgAbout.DoModal();
      }
      else
      {
       //很重要,使用缺省处理
       SetMsgHandled(FALSE);
      }
     }

  • 相关阅读:
    【leetcode】反转字符串
    【leetcode】反转字符串 II
    053-669
    053-668
    053-667
    053-666
    053-665
    053-664
    053-663
    053-662
  • 原文地址:https://www.cnblogs.com/huqingyu/p/47728.html
Copyright © 2011-2022 走看看