Solved

Help! How to change the tilebar of a CFormView?

Posted on 2000-02-25
4
226 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
  • 2
4 Comments
 
LVL 3

Expert Comment

by:akalmani
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Hi,

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

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now