MFCCALC: Demonstrates an Automation Server Application

Click to open or copy the MFCCALC project files.

MFCCALC is an Automation (formerly OLE Automation) server. It implements a simple calculator similar to the CALC application in Windows. It can be driven via Automation with the CALCDRIV sample or run stand-alone.

In prior versions of Visual C++, this functionality was provided by the OLE2 sample DSPCALC2. MFCCALC is simply an MFC version of DSPCALC2 and provides much the same functionality.

For more information, see the CALCDRIV sample.

This sample demonstrates the following keywords:

AfxGetApp; AfxGetInstanceHandle; AfxGetThread; AfxMessageBox; AfxOleInit; CCmdTarget::EnableAutomation; CDC::DrawIcon; CDC::GetSafeHdc; CDialog::Create; CDialog::DoModal; CDialog::OnCancel; CDialog::OnInitDialog; CDialog::OnOK; CMenu::AppendMenu; CMenu::ModifyMenu; CMenu::RemoveMenu; CRect::Height; CRect::Width; CString::Format; CString::IsEmpty; CString::LoadString; CWinApp::Enable3dControls; CWinApp::InitInstance; CWinApp::RunAutomated; CWinApp::RunEmbedded; CWnd::DestroyWindow; CWnd::DoDataExchange; CWnd::GetClientRect; CWnd::GetDlgItem; CWnd::GetSafeHwnd; CWnd::GetStyle; CWnd::IsIconic; CWnd::OnPaint; CWnd::OnQueryDragIcon; CWnd::OnSysCommand; CWnd::PostNcDestroy; CWnd::PreTranslateMessage; CWnd::SendMessage; CWnd::SetFocus; CWnd::SetWindowText; CWnd::ShowWindow; GetSystemMenu; GetSystemMetrics; LoadAccelerators; LoadIcon; MAKEINTRESOURCE; SetFocus; TranslateAccelerator