FWS_ADDTOTITLE & FWS_PREFIXTITLE
ANTONISAMY A MIEL -- antony@cauchy.miel.mot.com
Thursday, May 30, 1996
Env: Visual C++ 4.0/Windows 95
Have anyone tried using FWS_ADDTOTITLE & FWS_PREFIXTITLE.
These are undocumented Frame window styles described in
the Visual C++ Readme(Eratta) help in the Books Online
(Just search for FWS_ADDTOTITLE or FWS_PREFIXTITLE).
Although FWS_ADDTOTITLE works, I have problem using
FWS_PREFIXTITLE. As per the documentation, FWS_ADDTOTITLE
adds the current filename (or Untitled if no file is open)
to the Frame Window title and FWS_PREFIXTITLE uses
the format "Untitled - AppName" instead of
"AppName - Untitled". The document also says that by
default FWS_ADDTOTITLE is used but does not say anything
about FWS_PREFIXTITLE. But it can be seen from any
Appwizard application, the title takes the form
"Untitled - AppName". So FWS_PREFIXTITLE may also be
used by the framework by default. Since I want my title
to be of the second form, I added the following line to
my CMainFrame::PreCreateWindow()
cs.style &= ~FWS_PREFIXTITLE;
To make sure that FWS_ADDTOTITLE is set I even did this
cs.style |= FWS_ADDTOTITLE;
cs.style &= ~FWS_PREFIXTITLE;
But this does not work. I also (blindly, without any logic)
tried
cs.style |= FWS_PREFIXTITLE;
but no change in my title format.
Am I missing something?
Thanks is advance,
Antony
antony@miel.mot.com
Frederic Steppe -- FredericS@msn.com
Monday, June 03, 1996
[Mini-digest: 4 responses]
>Env: Visual C++ 4.0/Windows 95
> Have anyone tried using FWS_ADDTOTITLE & FWS_PREFIXTITLE.
> These are undocumented Frame window styles described in
> the Visual C++ Readme(Eratta) help in the Books Online
> (Just search for FWS_ADDTOTITLE or FWS_PREFIXTITLE).
>
> Although FWS_ADDTOTITLE works, I have problem using
> FWS_PREFIXTITLE. As per the documentation, FWS_ADDTOTITLE
> adds the current filename (or Untitled if no file is open)
> to the Frame Window title and FWS_PREFIXTITLE uses
> the format "Untitled - AppName" instead of
> "AppName - Untitled". The document also says that by
> default FWS_ADDTOTITLE is used but does not say anything
> about FWS_PREFIXTITLE. But it can be seen from any
> Appwizard application, the title takes the form
> "Untitled - AppName". So FWS_PREFIXTITLE may also be
> used by the framework by default. Since I want my title
> to be of the second form, I added the following line to
> my CMainFrame::PreCreateWindow()
> cs.style &= ~FWS_PREFIXTITLE;
> To make sure that FWS_ADDTOTITLE is set I even did this
> cs.style |= FWS_ADDTOTITLE;
> cs.style &= ~FWS_PREFIXTITLE;
> But this does not work.
MDC adds FWS_PREFIXTITLE to the frame window's only if the FWS_ADDTOTILE
style is set and the application is running under Windows 95 (see Win95 design
guide to find out why). This is done in the default
CFrameWnd::PreCreateWindow(), so you just have to remove this style AFTER the
call to the base class :
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
BOOL bResult = CFrameWnd::PreCreateWindow(cs);
cs.style &= ~FWS_PREFIXTITLE;
return bResult;
}
> I also (blindly, without any logic)
> tried
> cs.style |= FWS_PREFIXTITLE;
> but no change in my title format.
In this case, you are just enforcing the fact that FWS_PREFIXTITLE is set !
> Am I missing something?
Just a detail, don't worry.
Frederic Steppe (frederics@msn.com)
-----From: "K.V.R.M.Rao"
MFC code checks for FWS_ADDTOTITLE and if it is set and windows
version is 4.0 it automatically sets FWS_PREFIXTITLE.
So do the following in your frame window PreCreateWindow
override.
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
if(CFrameWnd::PreCreateWindow(cs))
{
cs.style = cs.style - FWS_PREFIXTITLE;
return TRUE;
}
else
return FALSE;
}
It will do what you want.
Good Luck.
Rammohan
Optima Software Services Ltd
Hyderabad
INDIA
-----From: Niels Ull Jacobsen
Use the source Luke.
Doing a Find in Files for FWS_PREFIXTITLE in the MFC source directory
reveals that FWS_PREFIXTITLE is added to the style in CFrameWnd::PreCreat=
eWnd
if you're running on Win95 or Nt 4.0. And it's tested in=20
CFrameWnd::UpdateFrameTitleForDocument.
So just set it *after* calling the base class PreCreateWnd, not before.
Niels Ull Jacobsen, Kr=FCger A/S (nuj@kruger.dk)
Everything stated herein is THE OFFICIAL POLICY of the entire Kruger=20
group and should be taken as legally binding in every respect.=20
Pigs will grow wings and fly.
-----From: Lee Jae Kil
set style below the base class PreCreateWindow().
CMainFrame::PreCreateWindow(...)
{
BOOL bRet = CMDIFrameWnd::PreCreateWindow(...);
cs.style &= ~FWS_PREFIXTITLE;
return bRet;
}
That's ok.
----
Lee, Jae Kil : juria@seodu.co.kr
| Вернуться в корень Архива
|