Solved

Help! How to change the tilebar of a CFormView?

Posted on 2000-02-25
4
275 Views
Last Modified: 2013-11-20
Hi,

I want to change the title of a CFormView,i used SetWindowText, but it does not work. any one knows how to do it?

Thanks  a lot!
0
Comment
Question by:greenbird
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 3

Expert Comment

by:akalmani
ID: 2560396
HI !!
  In OnInitialUpdate() use that SetWindowText("ajfk"); or else get the pointer to CFormView whenever u want to change the title use that pointer and call SetWindowText("kladf");
 
0
 
LVL 8

Accepted Solution

by:
VinExpert earned 5 total points
ID: 2560477
Hi,

I consider that U have 2 child views. Forst one is CFirstView and second one is CSecondView. Ur App class is CMyApp. Now follow the steps.

1. Hava a variable in the app class .h file to know witch child R U opening say
int m_iChildNo; which will be initialised to 0 in the app class consructor.

2. Then in the OnInitialUpdate function of first view access that variable using and as
CMyApp *pApp = (CMyApp *)AfxGetApp();
pApp->m_iChildNo = 1;

3. Then in the OnInitialUpdate function of second view access that variable using and as
CMyApp *pApp = (CMyApp *)AfxGetApp();
pApp->m_iChildNo = 2;

4. Map the SetTitle() function to the CMyDoc class and change it as
void CMyDoc::SetTitle(LPCTSTR lpszTitle)
{
CMyApp *pApp = (CMyApp *)AfxGetApp();
      
switch(pApp->m_iChildNo)
{
case 1:    //First view title
      lpszTitle = "Green";
                break;
case 2:      //Second view
                lpszTitle = "Bird";
                break;
}
CDocument::SetTitle(lpszTitle);
}

Thats it. It will work.

Hope this helps U.
VinExpert
0
 

Author Comment

by:greenbird
ID: 2560567
Hi,

thanks for all the help u had given. i will try it out later, if i got any problem, will come again :)

thanks a lot! and wish u a happy weekend!
0
 

Author Comment

by:greenbird
ID: 2567721
Hi,

hmmm it does not work... the title bar of the CFormView is still: untitled - myapp.... how come?
thanks!
0

Featured Post

Do you have a plan for Continuity?

It's inevitable. People leave organizations creating a gap in your service. That's where Percona comes in.

See how Pepper.com relies on Percona to:
-Manage their database
-Guarantee data safety and protection
-Provide database expertise that is available for any situation

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Suggested Courses

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question