Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 278
  • Last Modified:

Help! How to change the tilebar of a CFormView?

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
greenbird
Asked:
greenbird
  • 2
1 Solution
 
akalmaniCommented:
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
 
Vinayak KumbarSr Program ManagerCommented:
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
 
greenbirdAuthor Commented:
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
 
greenbirdAuthor Commented:
Hi,

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

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now