Page 62 - DCAP408_WEB_PROGRAMMING
P. 62
Windows Programming
Notes {
BOOL bNameValid;
CString strAboutMenu;
bNameValid = strAboutMenu.LoadString(IDS_ABOUTBOX);
ASSERT(bNameValid);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// Set the icon for this dialog. The framework does this
automatically
// when the application’s main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
m_BtnClose.SetWindowText(L”Close”);
return TRUE; // return TRUE unless you set the focus to a control
}
22. To execute the application, press F5
23. To close the dialog box, click its System Close button , , or
24. Display the dialog box
25. Right-click the button and click Add Event Handler
26. In the Event Handler Wizard, make sure the Message Type is set to BN_CLICKED
Ensure the Class List is set to CAppLauncher1Dlg. Click the Add And Edit button
27. Execute the OnClick event as follows:
void CAppLauncher1Dlg::OnBnClickedCloseBtn()
{
// TODO: Add your control notification handler code here
PostQuitMessage(WM_QUIT);
}
28. To execute the application, press F5
29. To close the dialog box, click the Close button and return to your programming environment
56 LOVELY PROFESSIONAL UNIVERSITY