(Single Document Interface)
- Create a new MFC->MC
Application named SDI1
- Create it as Single Document
- To add a dialog box, on the main
menu, click Project -> Add Resource...
- In the Add Resource dialog box,
double-click Dialog
- Change the ID of the new
dialog to IDD_GENERIC_DLG
- Right-click the dialog box and
click Add Class...
- Set the Class Name to CDependentDlg and base it on
CDialog, click Finish
- From the Class View, double-click the IDR_MAINFRAME menu
- On the right side of Help, click Type Here and type &Tools
- Click the box under Tools and type &Dependents... and press Enter
- Click and drag the Tools menu category to the left to position it between View and Help
- Right-click the Dependents menu item and click Add Event Handler...
- Set the Class List to the view class
- Click Add and Edit
// SD1View.cpp : implementation of the CSDI1View class // #include "stdafx.h" #include "SDI1.h" #include "SDI1Doc.h" #include "SDI1View.h" #include ".\sdi1view.h" #include "DependentDlg.h" #ifdef _DEBUG #define new DEBUG_NEW #endif . . . No Change // CSDI1View message handlers void CSDI1View::OnToolsDependents() { // TODO: Add your command handler code here CDependentDlg Dlg; Dlg.DoModal(); } |
Add red part in class CSDI1View in SD1View.h
virtual void OnToolsDependents();
Build Solution, Debug->Starting without debugging
No comments:
Post a Comment