15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


Title bar text on CFrameWnd

Bruce -- bmiller@geographix.com
Tuesday, September 24, 1996


Environment: VC++ 4.1, Windows NT 4.0

I need to access the child window number that appears in titlebar (the
':1' in mydoc1:1).
so I can override the  main portion but keep the window number.  When I
do a GetWindowText
in ShowWindow or anytime beforehand, all I get is 'mydoc1'.  I have not
disabled the FWS_ADDTOTITLE
style bit.

How can I get this info?

Bruce Miller
Lightning is God telling you to save your work.



Hugh Robinson -- hugh@ssihou.ssii.com
Thursday, September 26, 1996

[Mini-digest: 3 responses]


I was just looking at that code myself. Hopefully this will help...

First, MFC sets the frame title in the routine (have a look at the   
source).

The number you are after is stored in the m_nWindow member, which is   
initialized to -1 in CFrameWnd::CFrameWnd().
The test "if (m_nWindow > 0)" in CMDIChildWnd::OnUpdateFrameTitle shows   
why you are not getting the window title you expect:
whenever m_nWindow is <=0, you will get "mydoc1".

I think your answer lies in *when* you look at the window title text...   
m_nWindow is not updated until right at the end of   
CFrameWnd::InitialUpdateFrame().

When CFrameWnd::InitialUpdateFrame() runs, it sends the wm_initialupdate   
message to all your views (causing CView::OnInitialUpdate() to be   
called). However, m_nWindow is still set to -1 until right at the end of   
CFrameWnd::InitialUpdateFrame() , when the number is incremented by   
calling CDocument::UpdateFrameCounts().

If you call GetWindowText() after InitialUpdateFrame() has finished, I   
*think* you will be okay!

Now, what I would like to do is to be able to change the window title to   
reflect some information about the view as well as the document. I   
haven't figured that one out yet, though


Hugh Robinson
hugh@ssihou.ssii.com

 ----------
From:  owner-mfc-l
Sent:  Tuesday, September 24, 1996 7:48 PM
To:  'MFC list'
Subject:  Title bar text on CFrameWnd


Environment: VC++ 4.1, Windows NT 4.0

I need to access the child window number that appears in titlebar (the
':1' in mydoc1:1).
so I can override the  main portion but keep the window number.  When I
do a GetWindowText
in ShowWindow or anytime beforehand, all I get is 'mydoc1'.  I have not
disabled the FWS_ADDTOTITLE
style bit.

How can I get this info?

Bruce Miller
Lightning is God telling you to save your work.

-----From: "Krishna Prasad .P" 

	i tried your problem and found the GetWindowText() is returning 
everything on the Title bar including that " : 1 ".In CView derived class
I handled WM_LBUTTONDOWN message .The code in that handler is like this :

	CString str;
	GetParent()->GetWindowText(str);
	AfxMessageBox(str);

	Try this , you are always welcome for further clarifications.

with regards,

P.V.S Krishna Prasad,
Bangalore.


-----From: Jim Barry 

Check out the CFrameWnd::m_nWindow member and the function   
CMDIChildWnd::OnUpdateFrameTitle. OnUpdateFrameTitle is virtual so you   
should be able to override it to your satisfaction.

My approach would be simply to call CDocument::SetTitle() which updates   
all the frame captions automatically.

 - Jim  




| Вернуться в корень Архива |