Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » How to refresh the application title? Collapse All
Subject Author Date
Chun Pong Lau Mar 14, 2008 - 4:50 PM

I tried to use the following code to update the text in the application
title.

CWnd *pWnd = AfxGetMainWnd();
pWnd->SetWindowText(m_sCaption);
pWnd->SendMessage( WM_NCPAINT );
pWnd->Invalidate(1);
pWnd->UpdateWindow();

But it fails. We tried and found unless we do the following:

CWnd *pWnd = AfxGetMainWnd();
pWnd->SetWindowText(m_sCaption);
pWnd->ShowWindow(SW_HIDE);
pWnd->ShowWindow(SW_SHOW);

the application title will not be updated.

Is there a better way to refresh the application title (window text) ?

Technical Support Mar 17, 2008 - 11:02 AM

We used the SDI sample to check the problem. We modified the CChildView::OnViewColorControls() method in this sample and tested two versions of this method:

void CChildView::OnViewColorControls() 
{
      GetParentFrame() -> SetWindowText( _T("123") );
}

void CChildView::OnViewColorControls() 
{
      GetParentFrame() -> SetTitle( _T("123") );
      GetParentFrame() -> OnUpdateFrameTitle(FALSE);
}
This method is invoked from the View | Display Color Controls menu item. In both cases we saw the "123" text in the skinned caption of the main frame window. We guess the problem is specific to your project only. We need more details or a test project where this problem is demonstrated.