BOOL CMyDlg::OnInitDialog()
{
CDialog::OnInitDialog();
......
SetWindowText("My Title");
return TRUE; // return TRUE unless you set the focus to a control
}
其次还可以用API函数来完成:
::SetWindowText(m_hWnd, "My Title"); 或 ::SetWindowText(GetSafeHwnd(), "My Title");
m_hWnd 也是MFC对话框类的成员变量,可直接引用,GetSafeHwnd()的作用与其一样。