vc触发右上的X及改变主窗口的窗口名

  1.触发右上的X:
void C类Dlg::OnSysCommand(UINT nID, LPARAM lParam)
     {
         if ((nID & 0xFFF0) == IDM_ABOUTBOX)
          {
             CAboutDlg dlgAbout;   //if you have an about dialog
              dlgAbout.DoModal();
          }
          else if ((nID & 0xFFF0) == SC_CLOSE)
          {
              //用户点击右上角"X"
              EndDialog(IDOK);  
          }
          else
          {
              CDialog::OnSysCommand(nID, lParam);
          }
     }
2.改变主窗口的窗口名:
        AfxGetMainWnd()->SetWindowText(_T("窗口名"));

你可能感兴趣的:(c,dialog)