谢谢!

解决方案 »

  1.   

    BOOL SetWindowText(
      HWND hDlg,         // handle to your dialog
      LPCTSTR lpString   // title or text
    );
      

  2.   

    HWND GetDlgItem(
      HWND hDlg,       // handle to dialog box
      int nIDDlgItem   // control identifier
    );BOOL SetWindowText(
      HWND hWnd,         // handle to window or control
      LPCTSTR lpString   // title or text
    );你应该知道如何实现了吧!
      

  3.   

    得到句柄,setwindowtext不就行了
      

  4.   

    这样为什么不行呢:
    CStationDlg StationDlg;
    StationDlg.SetWindowText("ABC");
    StationDlg.DoModal();
      

  5.   

    AfxGetMainWnd()->SetWindowText("Caption") ;
    何时何地任意改变。(注:当前的窗口)
      

  6.   

    下面这样可以运行,但没什么效果:
    CStationDlg StationDlg;
    ::SetWindowText(StationDlg.m_hWnd, "ABC");
    StationDlg.DoModal();
      

  7.   

    CStationDlg StationDlg;
    所至的不是id
      

  8.   

    SetWindowText(HWND,...)
    这个函数调用时必须指定其需要操作的窗口,然后指定标题。 CStationDlg StationDlg;
    StationDlg.SetWindowText("ABC");
    StationDlg.DoModal();你这样作的话,该函数缺少句柄参数,当然不行啦!
      

  9.   

    >下面这样可以运行,但没什么效果:
    > CStationDlg StationDlg;
    > ::SetWindowText(StationDlg.m_hWnd, "ABC");
    > StationDlg.DoModal();
    你指定的不是窗口ID值,该函数改变的是该窗口的资源!
      

  10.   

    >下面这样可以运行,但没什么效果:
    > CStationDlg StationDlg;
    > ::SetWindowText(StationDlg.m_hWnd, "ABC");
    > StationDlg.DoModal();
    你指定的不是窗口ID值,该函数改变的是该窗口的资源!
      

  11.   

    CStationDlg StationDlg;
    StationDlg.SetWindowText("ABC");
    StationDlg.DoModal();
    上面编译通过,运行出错
      

  12.   

    TO:whmouse(飞天酷鼠) 你指定的不是窗口ID值,该函数改变的是该窗口的资源!不明白你的意思,请指教。
      

  13.   

    当然不行了,再Domodal()之前,窗口的句柄还是空的,当然会出错了,要再Domodal()过程中设置才行,也就是Domodal()后,返回之前才行。可以再OnInitiDialog()函数中。
      

  14.   

    CStationDlg dlg;
    dlg.SetWindowText("ABC");  // 不能改变吧。dlg并没有创建出来呀。
    StationDlg.DoModal();我觉的可以这样。在CStationdlg中加一个m_strTitle的变量。用一个函数
    SetTitle(CString str);来设置caption.在showwindow的时候在CStationDlg内部SetWindowText。应该没有问题。
      

  15.   

    CStationDlg StationDlg;
    StationDlg.SetWindowText("ABC");
    //::SetWindowText(StationDlg.m_hWnd, "ABC");
    StationDlg.DoModal();
    当然不行!
    此时窗口还没有创建,窗口句柄还是空的,不信你调试一下。
    此时执行StationDlg.SetWindowText("ABC");会出错,因为窗口还没有创建,
    而::SetWindowText(StationDlg.m_hWnd, "ABC");是没有效果的,因为此时
    StationDlg.m_hWnd 为NULL。
      

  16.   

    你可以在CStationDlg 类中添加一个成员变量 CString m_strTitle,
    然后在CStationDlg::OnInitDialog(...)中使用
    SetwindowText(m_strTitle)来改变窗口标题。
    (此时窗口已经创建,但是还没有显示。)
      

  17.   

    To jiangping_zhu(娜可露露之风之刃):同意!!!