Changing text in title bar 
Author Message
 Changing text in title bar

I am trying to change the default text generated by Visual C++
AppWizard, after the fact, with the following modifications to the
listed member function.  Changing all the other attributes of the
structure CREATESTRUCT work just fine.  However, there is no take on the
name change when the pointer cs.lpszName is directed to point to a new
string defined on the previous line.

Is there a way in the code to set the Title Bar text?  If so, can you
point me in the right direction?  Thanks.

= = =

BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
 // TODO: Modify the Window class or styles here by modifying
 //  the CREATESTRUCT cs

 // Keep all the current style features
 // except border should NOT be resizeable
 cs.style &= ~WS_THICKFRAME;

  // Set Calendar to be centered in the window
 // and sized to 1/4 screen height and 1/2 the screen width
 cs.cx = ::GetSystemMetrics(SM_CXSCREEN) / 2;
 cs.cy = ::GetSystemMetrics(SM_CYSCREEN) / 4;
 cs.x = (::GetSystemMetrics(SM_CXSCREEN) - cs.cx) / 2;
  cs.y = (::GetSystemMetrics(SM_CYSCREEN) - cs.cy) / 3;

 // Set name in title block
 char Name[] = "New Name";
 cs.lpszName = Name;

 return CFrameWnd::PreCreateWindow(cs);

Quote:
}

--
Best regards, Tom

***********************************************************************

"We crucify ourselves between two thieves: regret for yesterday
and fear of tomorrow."
  -- Fulton Oursler, American journalist and author (1893-1952)

***********************************************************************



Tue, 22 Aug 2000 03:00:00 GMT  
 Changing text in title bar

Hi!

Why don't you just change the appropriate strings (IDS_APP_TITLE etc.) in
your resource file?
(Or is this the wrong answer to the right question?)

Greetings from Germany, Pi.


Quote:
>I am trying to change the default text generated by Visual C++
>AppWizard, after the fact, with the following modifications to the
>listed member function.  Changing all the other attributes of the
>structure CREATESTRUCT work just fine.  However, there is no take on the
>name change when the pointer cs.lpszName is directed to point to a new
>string defined on the previous line.

>Is there a way in the code to set the Title Bar text?  If so, can you
>point me in the right direction?  Thanks.

>= = =

>BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
>{
> // TODO: Modify the Window class or styles here by modifying
> //  the CREATESTRUCT cs

> // Keep all the current style features
> // except border should NOT be resizeable
> cs.style &= ~WS_THICKFRAME;

>  // Set Calendar to be centered in the window
> // and sized to 1/4 screen height and 1/2 the screen width
> cs.cx = ::GetSystemMetrics(SM_CXSCREEN) / 2;
> cs.cy = ::GetSystemMetrics(SM_CYSCREEN) / 4;
> cs.x = (::GetSystemMetrics(SM_CXSCREEN) - cs.cx) / 2;
>  cs.y = (::GetSystemMetrics(SM_CYSCREEN) - cs.cy) / 3;

> // Set name in title block
> char Name[] = "New Name";
> cs.lpszName = Name;

> return CFrameWnd::PreCreateWindow(cs);
>}

>--
>Best regards, Tom

>***********************************************************************

>"We crucify ourselves between two thieves: regret for yesterday
>and fear of tomorrow."
>  -- Fulton Oursler, American journalist and author (1893-1952)

>***********************************************************************



Tue, 22 Aug 2000 03:00:00 GMT  
 Changing text in title bar

Hi Tom,

Quote:
>However, there is no take on the
>name change when the pointer cs.lpszName is directed to point to a new
>string defined on the previous line.
>BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
>{
> // ...
> // Set name in title block
> char Name[] = "New Name";
> cs.lpszName = Name;

> return CFrameWnd::PreCreateWindow(cs);
>}

First your var Name[] is thrown away as soon as the function is left
and second I'd prefer SetWindowText() somwhere later anyway. (For
dialogs in InitDialog for windows in OnInitialUpdate())

Carsten Witte
--
  book&data GmbH, 24235 Laboe, Reventloustrasse 5
  - Human       +49 (4343) 427713
  - Fox         +49 (4343) 427721
  - Spider      http://www.bookdata.de



Tue, 22 Aug 2000 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Changing text on title bar

2. Changing title bar text

3. How to programmatically change title bar text.

4. Changing title bar text

5. How to change Child Title Bar Text?

6. Changing Title Bar Text of a Child Window

7. Change Title Bar Text of CPropertySheet

8. Changing Title Bar Text of a Child Window

9. Text box on Title bar

10. show a text in the title bar

11. Text on title bar - Help!

12. Title Bar Text

 

 
Powered by phpBB® Forum Software