I'm probably not getting the entire picture here, but I assume from your description that CreateWindow directly calls your WndProc. If that is the case, isn't it guaranteed that after the base ctor runs the class has received the WM_CREATE message? I mean, the only issue happens when you are not quite through the ctor chain, no?

Right, what I'm saying is that it's the *subclass* who needs the notification more, than anyone else (although, for other reasons, the base class needs it as well). The whole point is to get the messages to the *subclasses* properly...

Or something else... there are a ton of situations that can happen -- such as MDI window creation, etc. -- that don't happen too often, but happen often enough that you simply can't assume you can get by without allowing them to handle the messages.)

You can use another mechanism to decide.  for instance:

class Window
   private bool inCreateWindow = false;
   ...
   final public void processMessage(int message)
   {
       if(inCreateWindow && message == WM_CREATE)
       {
           // handle specially
       }
       ...
   }
   this()
   {
      inCreateWindow = true;
      window = CreateWindow(&processMessage);
inCreateWindow = false; // all WM_CREATE messages will now go through normal mechanism.
   }
}

-Steve


Reply via email to