Click to open or copy the CMNCTRL2 project files.
CMNCTRL2 illustrates how to use the following common control MFC classes: CProgressCtrl, CSliderCtrl, and CSpinButtonCtrl. It shows how the controls are created and how to change the controls using many of the different available styles.
CMNCTRL2 is the result of replacing the original CMNCTRLS sample with two smaller projects: CMNCTRL1 (tree, toolbar, date and time picker, month calendar, and animate controls) and CMNCTRL2 (progress, up/down, and slider controls). This was done to reduce the footprint of the sample code, making it easier to trace specific portions of the application. The list control, originally in the CMNCTRLS sample, can now be found in the LISTHDR sample.
When you run CMNCTRL2, select the tab for the control you wish to activate. Select the styles and views from the check boxes, radio buttons, and combo boxes available in the different property pages. You will see how each one of the options changes the behavior and/or appearance of the control being displayed.
This sample demonstrates the following keywords:
CBitmap::LoadBitmap; CEdit::Clear; CEdit::GetLineCount; CEdit::LineIndex; CEdit::LineLength; CEdit::ReplaceSel; CEdit::SetSel; CFileDialog::DoModal; CFileDialog::GetPathName; CGdiObject::DeleteObject; CSpinButtonCtrl::GetBuddy; CString::GetBufferSetLength; CString::GetLength; CString::Left; CString::LoadString; CString::ReleaseBuffer; CWinApp::LoadIcon; CWnd::GetClientRect; CWnd::GetWindowRect; CWnd::SetWindowPos; CWnd::SetWindowText; DeleteItem; CWnd::DestroyWindow; CWnd::EnableWindow; GetCursorPos; GetDlgItem; GetParent; GetWindowLong; GetWindowRect; InvalidateRect; LoadIcon; MAKELONG; MessageBeep; ReleaseCapture; ScreenToClient; SetCapture; SetWindowLong; SetWindowPos; UpdateWindow; WindowProc; mbstowcs; rand; srand; time; wsprintf