CWnd::Create
Visual Studio 2008
Updated: October 2008
Creates the specified child window and attaches it to the CWnd object.
virtual BOOL Create( LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, Const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL );
Use the AfxRegisterWndClass function to register window classes. User defined window classes are available in the module where they are registered.
The CWnd::OnCreate method is called before the Create method returns, and before the window becomes visible.
// Dynamically create static control using CWnd::Create, // instead of with CStatic::Create, which doesn't // need the "STATIC" class name. void CMyDlg::OnCreateStatic() { // m_pWndStatic is a CWnd* member of CMyDlg m_pWndStatic = new CWnd; m_pWndStatic->Create(_T("STATIC"), _T("Hi"), WS_CHILD | WS_VISIBLE, CRect(0, 0, 20, 20), this, 1234); }