Following the prompt of Mark Ransom, I finally found a better function to implement my initialization. Although overloading CWnd :: SubclassWindow is a good idea, this function is not virtual and will require a call from a subclass pointer. Calling SubclassWindow from CWnd * will not work.
I found the function CWnd :: PreSubclassWindow . It is virtual and is called immediately before SubclassWindow. Since m_hwnd is really there, this is a good place to write the code I need. In addition, this function is virtual and is automatically called a wireframe, so I donβt have to worry about having a good pointer type
source share