Defining a custom *constructor* (not initializer!)
Mehrdad
wfunction at hotmail.com
Fri May 11 07:20:45 PDT 2012
On Friday, 11 May 2012 at 14:17:04 UTC, Steven Schveighoffer
wrote:
> Yeah, but given that the subclass is calling the base
> constructor, and the base constructor does not return until
> WM_CREATE is received, can't the subclass constructor pretend
> it received the message?
>
> -Steve
"pretend"?
No, because the window handle doesn't even EXIST until WM_CREATE
passes it to the window instance! (Sorry I guess I didn't mention
that, but it was kind of implicit in the fact that messages are
passed *before* CreateWindow() returns.)
Yes, CreateWindow() also returns a copy of the handle, but stuff
happens *before* the handle is returned, and in order for the
class to properly handle it, the handle is passed along with
WM_CREATE (and, in fact, with another message called WM_NCCREATE,
but we can ignore that for now).
The subclass has NO access to the window handle whatsoever before
the message comes, so no, it can't "pretend" to have received the
handle because that wouldn't be of any use.
More information about the Digitalmars-d
mailing list