请问如何在代码改vc中的标题 我有一vc程序,我想设置标题,我想重新设置,请问怎么做呀? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 在OnInitDialog中this->SetWindowText( "hello, world!" ); BOOL SetWindowText( HWND hWnd, // handle of window or control LPCTSTR lpString // address of string ); 顶!这么简单都不会???this->SetWindowText("Your Text");就行了. 调用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 ) } ) 我也是,不过我有另一个想法,你是想改变目前VC编译器上面的那个标题,嘿,先有FINDWINDOW,查找到句柄,再有SETWINDOWTEXT //下面代码设置计算器的CaptionHWND hwnd = ::FindWindow(NULL, "计算器");::SetWindowText(hwnd, "我的计算器"); HWND hwnd = ::FindWindow(NULL,"Title");if(hwnd) ::SetWindowText(hwnd,"New Title"); 新手数据库连接 我写的导航器在防缩是1.0情况下正常 放大缩小后就不正常了 寻找Pc-Lint 下载连接. 如何将文件指针移到下一行行首? 无法定位程序输入点 文档/视图程序,经常自动关闭,请问有可能是哪里的问题? vc向导自动生成的mfc多文档程序,各个文件的预处理顺序有谁知道, 问关于ado使用的菜鸟问题。 存储问题 Pro*C程序设计问题,也可能是VC++的问题,高手请进! 请问有下载关于图像装载,显示,放大方面源代码的地方吗?新手上路,多多指教。 请问ip助手能正确获得网卡的描述吗?类似Realtek RTL9139(A) PCI Fast Ethernet这样的
this->SetWindowText( "hello, world!" );
// handle of window or control
LPCTSTR lpString
// address of string
);
this->SetWindowText("Your Text");
就行了.
//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 )
}
)
HWND hwnd = ::FindWindow(NULL, "计算器");
::SetWindowText(hwnd, "我的计算器");
if(hwnd)
::SetWindowText(hwnd,"New Title");