The way I personally got around this problem was to put my creation function
in a Function by itself. override the Create method and the
PreSubclassWindow methods. From the Create function set a flag that says it
is being created using the create function, rather than being subclassed by
ddx_control. call the create after the create call the function to create my
internal controls. In the PreSubclassWindow method if the flag is not set
then call the function to create the internal controls.
BOOL CMyStatic::Create(LPCSTR lpszText,DWORD dwStyle,const RECT &rect,CWnd
m_bCreate = true;
"zhaoyandong" <email@example.com> wrote in message
> I want to create a CStatic derived class(eg. CMyStatic), which has some
> controls inside it.
> At first I want to add these controls at "CStatic::PreSubclassWindow", but
> if I want to create the CMyStatic programmically, error will appear.
> So I'm asking when should I add these controls to my class.
> Thank you.