请问:
消息OnCreate();
跟消息Create(。。);有什么区别?

解决方案 »

  1.   

    CWnd::OnCreate  
    afx_msg int OnCreate( LPCREATESTRUCT lpCreateStruct );
    The framework calls this member function when an application requests that the Windows window be created by calling the Create or CreateEx member function. The CWnd object receives this call after the window is created but before it becomes visible. OnCreate is called before the Create or CreateEx member function returns. CWnd::Create  
    virtual BOOL Create( LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);
    Res
    Creates a Windows child window and attaches it to the CWnd object. 
    You construct a child window in two steps. First, call the constructor, which constructs the CWnd object. Then call Create, which creates the Windows child window and attaches it to CWnd. Create initializes the window’s class name and window name and registers values for its style, parent, and ID.
      

  2.   

    Create不是消息,OnCreate是WM_CREATE消息响应函数(MFC)
      

  3.   

    UP,Create也是一个函数,Oncreate是响应WM_CREATE消息的函数
      

  4.   

    呵呵,Create一般是用来构造的函数。
      

  5.   

    Windows消息的处理函数都是在消息明前加On,去掉WM,例如:WM_CREATE的处理函数是OnCreate(),所以Create()不是消息处理函数
      

  6.   

    “Create一般是用来构造的函数。”
    它构造什么函数(窗口)?
      

  7.   

    还是看看《深入浅出MFC》吧。侯sir讲解的非常透彻。