我有一vc程序,我想设置标题,我想重新设置,请问怎么做呀?

解决方案 »

  1.   

    在OnInitDialog中
    this->SetWindowText( "hello, world!" );
      

  2.   

    BOOL SetWindowText( HWND hWnd, 
     // handle of window or control 
     
    LPCTSTR lpString 
     // address of string 
     
    ); 
     
      

  3.   

    顶!这么简单都不会???
    this->SetWindowText("Your Text");
    就行了.
      

  4.   

    调用CWnd : : SetWindowText可以改变任何窗口(包括控件)的标题。 
    //Set title for application's main frame window . 
    AfxGetMainWnd ( ) —> SetWindowText (_T("Application title") ) 
     
    //Set title for View's MDI child frame window . 
    GetParentFrame ( ) —> SetWindowText ("_T ("MDI Child Frame new title") 

     
    //Set title for dialog's push button control. 
    GetDigitem (IDC_BUTTON) —> SetWindowText (_T ("Button new title ") ) 
    如果需要经常修改窗口的标题(注:控件也是窗口),应该考虑使用半文档化的函数AfxSetWindowText。该函数在AFXPRIV.H中说明,在WINUTIL.CPP中实现,在联机帮助中找不到它,它在AFXPRIV.H中半文档化, 在以后发行的MFC中将文档化。 
    AfxSetWindowText的实现如下: 
    voik AFXAPI AfxSetWindowText (HWND hWndCtrl , LPCTSTR IpszNew ) 

    itn nNewLen= Istrlen (Ipaznew) 
    TCHAR szOld [256] 
    //fast check to see if text really changes (reduces 
    flash in the 
    controls ) 
    if (nNewLen >_contof (szOld) 
    || : : GetWindowText (hWndCrtl, szOld , _countof (szOld) !=nNewLen 
    || Istrcmp (szOld , IpszNew)! = 0 

    //change it 
    : : SetWindowText(hWndCtrl , IpszNew ) 


      

  5.   

    我也是,不过我有另一个想法,你是想改变目前VC编译器上面的那个标题,嘿,先有FINDWINDOW,查找到句柄,再有SETWINDOWTEXT
      

  6.   

    //下面代码设置计算器的Caption
    HWND hwnd = ::FindWindow(NULL, "计算器");
    ::SetWindowText(hwnd, "我的计算器");
      

  7.   

    HWND hwnd = ::FindWindow(NULL,"Title");
    if(hwnd)
      ::SetWindowText(hwnd,"New Title");