软件体系结构实验一实验报告文档格式.docx
《软件体系结构实验一实验报告文档格式.docx》由会员分享,可在线阅读,更多相关《软件体系结构实验一实验报告文档格式.docx(11页珍藏版)》请在冰豆网上搜索。
步骤2:
将图示的调用结构用菜单消息实现。
(1)每个下层模块用子菜单呈现。
(2)底层模块用对话框实现。
过程:
1、运行VC++6.0开发平台,选择“文件”——“新建”——“MFCAppwizard(exe)”,工程名称设为“Hotel_MIS”,选择工程存放路径,确定
2、选择“单文档”,点击“完成”按钮,进入如图1界面
图1
3、选择“ResourceView”选项卡,依次展开“Hotel_MISresources”——“Menu”文件夹,双击Menu文件夹下的“IDR_MAINFRAME”,出现如图2所示结果
图2
4、添加功能模块,如图3所示
图3
5、在“ResourceView”选项卡,依次展开“Hotel_MISresources”——“Dialog”文件夹,右键点击“Dialog”创建对话框,如图4所示
图4
6、在每个功能模块的属性框将ID改为IDD_ABOUTBOX,编译执行结果如图5所示
图5
步骤3:
总结实验和设计经验,编写实验报告
详细代码:
//Hotel_MIS.cpp:
Definestheclassbehaviorsfortheapplication.
//
#include"
stdafx.h"
Hotel_MIS.h"
MainFrm.h"
Hotel_MISDoc.h"
Hotel_MISView.h"
#ifdef_DEBUG
#definenewDEBUG_NEW
#undefTHIS_FILE
staticcharTHIS_FILE[]=__FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
//CHotel_MISApp
BEGIN_MESSAGE_MAP(CHotel_MISApp,CWinApp)
//{{AFX_MSG_MAP(CHotel_MISApp)
ON_COMMAND(ID_APP_ABOUT,OnAppAbout)
//NOTE-theClassWizardwilladdandremovemappingmacroshere.
//DONOTEDITwhatyouseeintheseblocksofgeneratedcode!
//}}AFX_MSG_MAP
//Standardfilebaseddocumentcommands
ON_COMMAND(ID_FILE_NEW,CWinApp:
:
OnFileNew)
ON_COMMAND(ID_FILE_OPEN,CWinApp:
OnFileOpen)
//Standardprintsetupcommand
ON_COMMAND(ID_FILE_PRINT_SETUP,CWinApp:
OnFilePrintSetup)
END_MESSAGE_MAP()
//CHotel_MISAppconstruction
CHotel_MISApp:
CHotel_MISApp()
{
//TODO:
addconstructioncodehere,
//PlaceallsignificantinitializationinInitInstance
}
//TheoneandonlyCHotel_MISAppobject
CHotel_MISApptheApp;
//CHotel_MISAppinitialization
BOOLCHotel_MISApp:
InitInstance()
AfxEnableControlContainer();
//Standardinitialization
//Ifyouarenotusingthesefeaturesandwishtoreducethesize
//ofyourfinalexecutable,youshouldremovefromthefollowing
//thespecificinitializationroutinesyoudonotneed.
#ifdef_AFXDLL
Enable3dControls();
//CallthiswhenusingMFCinasharedDLL
#else
Enable3dControlsStatic();
//CallthiswhenlinkingtoMFCstatically
//Changetheregistrykeyunderwhichoursettingsarestored.
Youshouldmodifythisstringtobesomethingappropriate
//suchasthenameofyourcompanyororganization.
SetRegistryKey(_T("
LocalAppWizard-GeneratedApplications"
));
LoadStdProfileSettings();
//LoadstandardINIfileoptions(includingMRU)
//Registertheapplication'
sdocumenttemplates.Documenttemplates
//serveastheconnectionbetweendocuments,framewindowsandviews.
CSingleDocTemplate*pDocTemplate;
pDocTemplate=newCSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CHotel_MISDoc),
RUNTIME_CLASS(CMainFrame),//mainSDIframewindow
RUNTIME_CLASS(CHotel_MISView));
AddDocTemplate(pDocTemplate);
//Parsecommandlineforstandardshellcommands,DDE,fileopen
CCommandLineInfocmdInfo;
ParseCommandLine(cmdInfo);
//Dispatchcommandsspecifiedonthecommandline
if(!
ProcessShellCommand(cmdInfo))
returnFALSE;
//Theoneandonlywindowhasbeeninitialized,soshowandupdateit.
m_pMainWnd->
ShowWindow(SW_SHOW);
UpdateWindow();
returnTRUE;
//CAboutDlgdialogusedforAppAbout
classCAboutDlg:
publicCDialog
public:
CAboutDlg();
//DialogData
//{{AFX_DATA(CAboutDlg)
enum{IDD=IDD_ABOUTBOX};
//}}AFX_DATA
//ClassWizardgeneratedvirtualfunctionoverrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtualvoidDoDataExchange(CDataExchange*pDX);
//DDX/DDVsupport
//}}AFX_VIRTUAL
//Implementation
protected:
//{{AFX_MSG(CAboutDlg)
//Nomessagehandlers
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CAboutDlg:
CAboutDlg():
CDialog(CAboutDlg:
IDD)
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
voidCAboutDlg:
DoDataExchange(CDataExchange*pDX)
CDialog:
DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
BEGIN_MESSAGE_MAP(CAboutDlg,CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
//Appcommandtorunthedialog
voidCHotel_MISApp:
OnAppAbout()
CAboutDlgaboutDlg;
aboutDlg.DoModal();
//CHotel_MISAppmessagehandlers
//Hotel_MISView.cpp:
implementationoftheCHotel_MISViewclass
//CHotel_MISView
IMPLEMENT_DYNCREATE(CHotel_MISView,CView)
BEGIN_MESSAGE_MAP(CHotel_MISView,CView)
//{{AFX_MSG_MAP(CHotel_MISView)
//Standardprintingcommands
ON_COMMAND(ID_FILE_PRINT,CView:
OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT,CView:
ON_COMMAND(ID_FILE_PRINT_PREVIEW,CView:
OnFilePrintPreview)
//CHotel_MISViewconstruction/destruction
CHotel_MISView:
CHotel_MISView()
addconstructioncodehere
~CHotel_MISView()
BOOLCHotel_MISView:
PreCreateWindow(CREATESTRUCT&
cs)
ModifytheWindowclassorstylesherebymodifying
//theCREATESTRUCTcs
returnCView:
PreCreateWindow(cs);
//CHotel_MISViewdrawing
voidCHotel_MISView:
OnDraw(CDC*pDC)
CHotel_MISDoc*pDoc=GetDocument();
ASSERT_VALID(pDoc);
adddrawcodefornativedatahere
//CHotel_MISViewprinting
OnPreparePrinting(CPrintInfo*pInfo)
//defaultpreparation
returnDoPreparePrinting(pInfo);
OnBeginPrinting(CDC*/*pDC*/,CPrintInfo*/*pInfo*/)
addextrainitializationbeforeprinting
OnEndPrinting(CDC*/*pDC*/,CPrintInfo*/*pInfo*/)
addcleanupafterprinting
//CHotel_MISViewdiagnostics
AssertValid()const
CView:
AssertValid();
Dump(CDumpContext&
dc)const
Dump(dc);
CHotel_MISDoc*CHotel_MISView:
GetDocument()//non-debugversionisinline
ASSERT(m_pDocument->
IsKindOf(RUNTIME_CLASS(CHotel_MISDoc)));
return(CHotel_MISDoc*)m_pDocument;
#endif//_DEBUG
//CHotel_MISViewmessagehandlers
实验总结:
通过这次实验,我对事件驱动的基本架构有所了解,并了解基于事件驱动模式的编程的基本设计方法,对WINDOWS的程序平台上的设计实现方法也有一定掌握,但仍有许多不足之处,比如在编程实现方面仍然很薄弱,我将在今后的学习中加强这方面上的练习。