"Joseph M. Newcomer" <newcomer@flounder.com> wrote in message
See below...
On Thu, 16 Oct 2008 17:19:25 +0100, "Bill Davy" <Bill@XchelSys.co.uk>
wrote:
{
CWnd* p1 = GetDlgItem(IDC_STATICABOUTVERSION);
CStatic *p2 = dynamic_cast<CStatic*>(p1);
LOGINFO((void*)p1 << " => " << (void*)p2);
}
17:15:34.792 - INFO - CAboutDlg::OnInitDialog() - 016B46A8 => 00000000
Any thoughts?
****
Yes. Stop using GetDlgItem. It is essentially obsolete for common
programming. It is
clear from this usage that it is completely inappropriate; create a class
member and just
use it. Don't waste your time trying to use MFC as if it is bare Win32
with no support.
Use it correctly. Forget you ever heard of GetDlgItem; if you are writing
more than once
a year, you are not using MFC correctly.
I would write this simply as
c_AboutVersion.SetWindowText(...something useful here...);
you have taken three overly complex lines to accomplish a trivial one-line
task.
joe
****
Bill
Out until Monday - hooray!
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
Wow, just explored add member. I'm going to spend a few days removing all
trace of GetDlgItem(). Wish the documentation mentioned it was not the way
to go.
Many thanks to you all for your excellent advice.