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

Print Search « Previous Thread Next Thread »
   05-18-2006, 1:36 AM
agenore is not online. Last active: 7/24/2006 9:38:58 AM agenore



Top 10 Posts
Joined on 03-21-2006
Parma
Posts 26
Sad [:(] 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 is not online. Last active: 1/5/2008 4:01:46 PM theDentist

Top 10 Posts
Joined on 12-05-2005
Posts 42
Re: Rename Title window

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 is not online. Last active: 7/24/2006 9:38:58 AM agenore



Top 10 Posts
Joined on 03-21-2006
Parma
Posts 26
Re: Rename Title window
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 is not online. Last active: 1/5/2008 4:01:46 PM theDentist

Top 10 Posts
Joined on 12-05-2005
Posts 42
Re: Rename Title window

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 is not online. Last active: 1/5/2008 4:01:46 PM theDentist

Top 10 Posts
Joined on 12-05-2005
Posts 42
Re: Rename Title window

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 is not online. Last active: 7/24/2006 9:38:58 AM agenore



Top 10 Posts
Joined on 03-21-2006
Parma
Posts 26
Re: Rename Title window
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

MENU
Home
MFC 
C++
.Net
WIN32
Programming
Forum
My Articles
Welcome to Codersource.Net Login | Register | Faq  

Google
 

NOTES:


Thanks for visiting our CoderSource.net. This site will be improved with more articles. Interested visitors can also submit their articles through the Submit Article link.Your article will also be published after due consideration by the editor. 

© Copyright 2003. All rights on content reserved by CoderSource.net. Contact    About Us