// Create a button object and hide it initially CButton myButton; myButton.Create(_T("Button"), WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, CRect(10, 10, 50, 50), this, 1); myButton.ShowWindow(FALSE);
// Declare a member variable for a button object in the dialog box class class CMyDialogBox : public CDialogEx { // ... CButton m_myButton; // ... }; // Show the button on the dialog box BOOL CMyDialogBox::OnInitDialog() { // ... m_myButton.Create(_T("Button"), WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, CRect(10, 10, 50, 50), this, 1); m_myButton.ShowWindow(TRUE); // ... }In this example, we declare a member variable for a CButton object in the CMyDialogBox class. In the OnInitDialog() method, we create the button and set its visibility property to TRUE, effectively showing it on the dialog box. Package/library: This method belongs to the MFC (Microsoft Foundation Class) framework, which is a collection of C++ classes provided by Microsoft to facilitate the creation of Windows applications. Specifically, it belongs to the CButton class, which is part of the Controls section of the MFC framework.