Re: Child Window Creation
I have no idea.
Here is content of the exception dialog box, if that helps!
Unhandled exception at 0x7c90120e in CreateProblem.exe: User breakpoint.
At that point the stack is deep in user32.dll and ntdll.dll.
I did make a sample that make this very easy to see!
http://www.learnstar.com/AliR/CreateProblem.zip
I can't catch the exception! Even with my try catch statement it will
simply break in the debugger.
I have tried to figure out why I get the exception, but haven't been able to
yet. If you can figure it out, please let me know.
AliR.
"Joseph M. Newcomer" <newcomer@flounder.com> wrote in message
news:u4m305d7crti0iojf4g6ff624s88lm5pkr@4ax.com...
Define "throws an exception". Is it a C SEH exception or a C++/MFC
CException-derived
class. If the latter, who throws it and why?
This is one of the classic "My program crashes, what's wrong?"
questions...come on, you
know better!
The HWND probably IS valid. The open question is why you are getting an
exception, and
that's a question worth investigating!
joe
On Wed, 6 May 2009 10:29:00 -0500, "AliR \(VC++ MVP\)"
<AliR@online.nospam> wrote:
Thanks for the suggestion David. I would do that but....
When PreSubclassWindow gets called as a result of Create begin called on
the
control, the HWND for the control looks valid, but when I try to create
child controls with it, it throws an exception. So it will try to create
it
in PreSubclassWindow method and will crash.
Try the sample I posted earlier.
AliR.
"David Ching" <dc@remove-this.dcsoft.com> wrote in message
news:eur9BplzJHA.4800@TK2MSFTNGP06.phx.gbl...
"AliR (VC++ MVP)" <AliR@online.nospam> wrote in message
news:A11Ml.15235$jZ1.1214@flpi144.ffdc.sbc.com...
Since WM_PAINT is getting called before my posted message when
DDX_Control
is used, I'm going with the flag solution for now.
Unless someone can come up with a better solution.
Create your child windows in a method called in both OnCreate() and
PresubclassWindow(). In that method, quickly abort if any of the child
windows have already been created, e.g. m_childWindow.GetSafeHwnd() !=
NULL. Then you don't need a m_bCreated flag.
-- David
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm