Condividi tramite


CWnd::OnCreate

The framework calls this member function when an application requests that the Windows window be created by calling the Create or CreateEx member function.

afx_msg int OnCreate(
   LPCREATESTRUCT lpCreateStruct 
);

Parameters

  • lpCreateStruct
    Points to a CREATESTRUCT structure that contains information about the CWnd object being created.

Return Value

OnCreate must return 0 to continue the creation of the CWnd object. If the application returns –1, the window will be destroyed.

Remarks

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.

Override this member function to perform any needed initialization of a derived class.

The CREATESTRUCT structure contains copies of the parameters used to create the window.

Nota

This member function is called by the framework to allow your application to handle a Windows message. The parameters passed to your function reflect the parameters received by the framework when the message was received. If you call the base-class implementation of this function, that implementation will use the parameters originally passed with the message and not the parameters you supply to the function.

Requirements

Header: afxwin.h

See Also

Reference

CWnd Class

Hierarchy Chart

CWnd::CreateEx

CWnd::OnNcCreate

WM_CREATE

CWnd::Default

CWnd::FromHandle

Concepts

CWnd Members