SetWindowText无法改变标题怎么回事?

来源:百度知道 编辑:UC知道 时间:2024/06/15 09:36:25
怎么回事呢?先是在CMainFrame里面用SetWindowText ("")里没有成功!
于是又在CAView里面用GetParent () -> SetWindowText ("")也没有成功
于是又在CAView里面用::SetWindowText (m_hWnd, ””)也没有成功
咋回事?

在CMainFrame的PreCreatWindow中

加入:

cs.style&=~FWS_ADDTOTITLE;
cs.lpszName="哟哟哟";

((CMainFrame *)AfxGetApp()->m_pMainWnd)->SetWindowText("");
试试这样

试一下
把代码加这个函数里InitInstance()
if (!ProcessShellCommand(cmdInfo))
return FALSE;

// The one and only window has been initialized, so show and update it.
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();
m_pMainWnd->SetWindowText("VC");//加这里
你的方法不要行主要是
ProcessShellCommand(cmdInfo))这个函数调用东西太多
最后调用了这个函数改变标题
void CFrameWnd::InitialUpdateFrame(CDocument* pDoc, BOOL bMakeVisible)
{
// if the frame does not have an active view, set to first pane
CView* pView = NULL;
if (GetActiveView() == NULL)
{
CWnd* pWnd = GetDescendantWindow(AFX_IDW_PANE_FIRST, TRUE);
if (pWnd != NULL && pWnd->IsKindOf(RUNTIME_CLASS(CView)))
{
pView = (CView*