Add text to title bar (or document header)
-
How do you add text to the title bar of an application using Microsoft Visual Studio 2003 .NET Visual C++?
SetWindowText() or WM_SETTEXT. Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
SetWindowText() or WM_SETTEXT. Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
SetWindowText() or WM_SETTEXT. Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
This application has a mainframe window and like an older version of Microsoft Word documents, it can have multiple files open (MDI). If you tile the windows, the active window's file name title shows in the mainframe's. The format the header or title bar has is as follows: [Application Name] - [Filename.extension] I want to modify it like this: [Application Name] - [Filename.extension] - [My Text Added Here] The problem is I do not have a handle to this section such as SetTitle() or SetName() and I am thinking I need to add a section to have such a handle. However, this is dealing with MFC.
-
This application has a mainframe window and like an older version of Microsoft Word documents, it can have multiple files open (MDI). If you tile the windows, the active window's file name title shows in the mainframe's. The format the header or title bar has is as follows: [Application Name] - [Filename.extension] I want to modify it like this: [Application Name] - [Filename.extension] - [My Text Added Here] The problem is I do not have a handle to this section such as SetTitle() or SetName() and I am thinking I need to add a section to have such a handle. However, this is dealing with MFC.
GetWindowTextLength()/GetWindowText() or W<_GETTEXT/WM_GETTEXTLENGTH can be used to get the current title. Append your new text and set the new text. For MFC you can use something like CString titlestr; MainWnd->GetWindowText(titlestr); titlestr += _T(" - [My Text Added Here]"); MainWnd->SetWindowText(titlestr); Mark
Mark Salsbery Microsoft MVP - Visual C++ :java: