|
|
|
Rename Title window
Started by agenore at 05-18-2006 1:36 AM. Topic has 5 replies.
|
|
05-18-2006, 1:36 AM
|
agenore

Joined on 03-21-2006
Parma
Posts 26
|
Rename Title window
|
|
|
|
|
Hi, In a dialog form I can modify the title by the function SetWindowText(..) on the method OnInitDialog(...) but when I've tried to do the same work on a child form window on the method OnInitialUpdate(...) it doesn't work. Why?
Thanks...
|
|
|
|
|
Report
|
|
|
|
05-19-2006, 10:20 AM
|
theDentist
Joined on 12-05-2005
Posts 42
|
|
|
|
Hi,
I suppose you mean a child window in a MDI mainframe application. One way that works is editing the resource file directly. Go to the following section:
STRINGTABLE PRELOAD DISCARDABLE BEGIN IDR_MAINFRAME "<this is the title of the Parent Window" IDR_MDIAPPTYPE "\n<modify here>\n<modify here>" END
where it says <modify here> enter the title you want for you window. This seems to work. Hope it helps.
Peter
|
|
|
|
|
Report
|
|
|
|
05-21-2006, 1:47 AM
|
agenore

Joined on 03-21-2006
Parma
Posts 26
|
|
|
Ok, It seem works! Explain me best. When I open a child window named 'router' on the title bar appear 'router1'. If I open another window the title is 'router2'. I don't want this. Is It possible to set the title by code? thanks
|
|
|
|
|
Report
|
|
|
|
05-25-2006, 1:06 PM
|
theDentist
Joined on 12-05-2005
Posts 42
|
|
|
|
Hi,
I'm working on it, I never thought something that should be so simple is so difficult. I let you know when I come up with something. Anyone out there to help with this one, I would like to know too.
Peter
|
|
|
|
|
Report
|
|
|
|
05-25-2006, 2:54 PM
|
theDentist
Joined on 12-05-2005
Posts 42
|
|
|
|
Hi,
It's me again, If you create an OnPaint function in the CChildFrame class, and put:
this->SetWindowText(<your title>);
in the paint event handler, if will work. If you want different child windows instead of instances of the same class, you will have to create a class for each child window with the CMDIChildWindow as the base class.
Hope this helps. I suppose this is the problem using the a Wizard instead of coding from scratch.
Regards
Peter
|
|
|
|
|
Report
|
|
|
|
05-26-2006, 3:38 AM
|
agenore

Joined on 03-21-2006
Parma
Posts 26
|
|
|
Hi, I will try your tip. I have found another method. You must overwrite the method SetTitle on CDocument class so
void CTestDoc::SetTitle(LPCTSTR lpszTitle) { CDocument::SetTitle("agenore"); }
It works fine.
One problem, two solutions...... good!!!
|
|
|
|
|
Report
|
|
|
|
|
Codersource.Net » Programming » MFC Programming » Rename Title window
|
|
| |
|