Book info: MFC Problem Solver
Raja Segar -- rsz@pc.jaring.my
Thursday, September 19, 1996
Environment: MSVC 4.0, Windows 95, NT 3.51
He there ..
There is a superb MFC Problem solver book release by Waite Group.
Visual C++ 4.0 HOW TO - Scott StansField.
It probably has answers to almost all the questions i see in
this list. It's no nonsense approach to MFC problem solving is
unmatched by any book in the market. Check it out.. It does not
cover any database stuff though ..
It is worth it's weight in gold to a MFC Programmer.
BTW here is a tip from the book ...
If you want to get a pointer to your statusbar or toolbar ..etc from
anywhere in your program just do the following..
CStatusBar* pStatusbar = (CStatusBar*)AfxGetMainWnd()->
GetDescendantWindow(AFX_IDW_STATUS_BAR);
^
Replace with Control ID
if applicable.
Bye
____ __ _____
/ __ \ __ __ ____/ / ___/__ /
/ / / // / / // __ / / _ \ / /
/ /_/ // /_/ // /_/ / / __// /__
/_____/ \__,_/ \__,_/ \___//____/
Roger Onslow/Newcastle/Computer Systems Australia/
Monday, September 23, 1996
>BTW here is a tip from the book ...
>If you want to get a pointer to your statusbar or toolbar ..etc from
>anywhere in your program just do the following..
>
>CStatusBar* pStatusbar = (CStatusBar*)AfxGetMainWnd()->
>GetDescendantWindow(AFX_IDW_STATUS_BAR);
doing "GetDescendantWindow(AFX_IDW_STATUS_BAR,TRUE);" is better.
Even better still, you can use GetMessageBar() (which does the same as the
above, but is more obvious when you try to read the code) like this...
CStatusBar* pStatusbar =
static_cast(::AfxGetMainWnd()->GetMessageBar());
This also works when called from a CMDIChildWnd, so if you're in a view (or
child of a view) you could simple call GetParentFrame() and then call
GetMessageBar().
NOTE: used static_cast here rather than C-style case -- they are "safer" and
also an aid when trying to understand and find casts in your code. I suggest
you always use the new C++ cast operators (especially when converting
to/from/between pointers).
Roger Onslow
| Вернуться в корень Архива
|