版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、 西华大学实验报告第 组 . 西华大学实验报告(计算机类)开课学院及实验室:机械工程与自动化 实验时间 : 年 月 日学 生 姓 名 学 号 成 绩学生所在学院机械工程与自动化年级/专业/班2011级机电 班课 程 名 称高级语言在测控中的应用课 程 代 码6003559实验项目名称简单的MFC应用程序设计项 目 代 码指 导 教 师项 目 学 分一、实验目的1. 理解Windows编程特点;2. 了解MFC应用程序的消息映射、数据映射机制;3. 掌握用AppWizard(exe)创建SDI和MDI应用程序的方法;4. 掌握使用项目工作区窗口的ClassView页面为类添加成员的方法;5. 掌
2、握用ClassWizard映射消息的方法。6. 掌握对话框编辑器的使用方法;7. 熟悉对话框的编程过程及控件的创建和使用方法;8. 掌握静态控件、按钮和编辑框控件的使用方法。二、内容与设计思想上机实践内容:1 设计一个对话框,用于学生成绩的输入,要求能输入学生姓名、学号、性别以及3门课程成绩,单击“求平均”按钮是计算3门课程的平均成绩并显示在上面的静态文本框中。通过单击“测试”菜单下的“成绩录入”子菜单调用该对话框,在该对话框中要用到控件:静态文本、编辑框(单行和多行)、单选框、复选框、组框、按钮等,其运行结果如下:算法设计思想与算法实现步骤等。三、使用环境操作系统:Windowns XP+环
3、境:Visual C+ 6.0四、核心代码及调试过程/ ScoreInput.cpp : Defines the class behaviors for the application./#include "stdafx.h"#include "ScoreInput.h"#include "MainFrm.h"#include "ScoreInputDoc.h"#include "ScoreInputView.h"#ifdef _DEBUG#define new DEBUG_NEW#undef
4、THIS_FILEstatic char THIS_FILE = _FILE_;#endif/ CScoreInputAppBEGIN_MESSAGE_MAP(CScoreInputApp, CWinApp)/AFX_MSG_MAP(CScoreInputApp)ON_COMMAND(ID_APP_ABOUT, OnAppAbout)/ NOTE - the ClassWizard will add and remove mapping macros here./ DO NOT EDIT what you see in these blocks of generated code!/AFX_M
5、SG_MAP/ Standard file based document commandsON_COMMAND(ID_FILE_NEW, CWinApp:OnFileNew)ON_COMMAND(ID_FILE_OPEN, CWinApp:OnFileOpen)/ Standard print setup commandON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp:OnFilePrintSetup)END_MESSAGE_MAP()/ CScoreInputApp constructionCScoreInputApp:CScoreInputApp()/ TOD
6、O: add construction code here,/ Place all significant initialization in InitInstance/ The one and only CScoreInputApp objectCScoreInputApp theApp;/ CScoreInputApp initializationBOOL CScoreInputApp:InitInstance()AfxEnableControlContainer();/ Standard initialization/ If you are not using these feature
7、s and wish to reduce the size/ of your final executable, you should remove from the following/ the specific initialization routines you do not need.#ifdef _AFXDLLEnable3dControls();/ Call this when using MFC in a shared DLL#elseEnable3dControlsStatic();/ Call this when linking to MFC statically#endi
8、f/ Change the registry key under which our settings are stored./ TODO: You should modify this string to be something appropriate/ such as the name of your company or organization.SetRegistryKey(_T("Local AppWizard-Generated Applications");LoadStdProfileSettings(); / Load standard INI file
9、options (including MRU)/ Register the application's document templates. Document templates/ serve as the connection between documents, frame windows and views.CSingleDocTemplate* pDocTemplate;pDocTemplate = new CSingleDocTemplate(IDR_MAINFRAME,RUNTIME_CLASS(CScoreInputDoc),RUNTIME_CLASS(CMainFra
10、me), / main SDI frame windowRUNTIME_CLASS(CScoreInputView);AddDocTemplate(pDocTemplate);/ Parse command line for standard shell commands, DDE, file openCCommandLineInfo cmdInfo;ParseCommandLine(cmdInfo);/ Dispatch commands specified on the command lineif (!ProcessShellCommand(cmdInfo)return FALSE;/
11、The one and only window has been initialized, so show and update it.m_pMainWnd->ShowWindow(SW_SHOW);m_pMainWnd->UpdateWindow();return TRUE;/ CAboutDlg dialog used for App Aboutclass CAboutDlg : public CDialogpublic:CAboutDlg();/ Dialog Data/AFX_DATA(CAboutDlg)enum IDD = IDD_ABOUTBOX ;CButtonm_
12、Avg;floatm_avg;intm_english;intm_yuwen;intm_math;/AFX_DATA/ ClassWizard generated virtual function overrides/AFX_VIRTUAL(CAboutDlg)protected:virtual void DoDataExchange(CDataExchange* pDX); / DDX/DDV support/AFX_VIRTUAL/ Implementationprotected:/AFX_MSG(CAboutDlg)afx_msg void OnButton1();/AFX_MSGDEC
13、LARE_MESSAGE_MAP();CAboutDlg:CAboutDlg() : CDialog(CAboutDlg:IDD)/AFX_DATA_INIT(CAboutDlg)m_avg = 0.0f;m_english = 0;m_yuwen = 0;m_math = 0;/AFX_DATA_INITvoid CAboutDlg:DoDataExchange(CDataExchange* pDX)CDialog:DoDataExchange(pDX);/AFX_DATA_MAP(CAboutDlg)DDX_Control(pDX, IDC_BUTTON1, m_Avg);DDX_Text
14、(pDX, IDC_EDIT1, m_avg);DDX_Text(pDX, IDC_EDIT4, m_english);DDX_Text(pDX, IDC_EDIT5, m_yuwen);DDX_Text(pDX, IDC_EDIT6, m_math);/AFX_DATA_MAPBEGIN_MESSAGE_MAP(CAboutDlg, CDialog)/AFX_MSG_MAP(CAboutDlg)ON_BN_CLICKED(IDC_BUTTON1, OnButton1)/AFX_MSG_MAPEND_MESSAGE_MAP()/ App command to run the dialogvoid CScoreInputApp:OnAppAbout()CAboutDlg aboutDlg;aboutDlg.DoModal();/ CScoreInputApp message handlersvoid CAboutDlg:OnButton1() / TODO: Add your control notification handler code here/int s,a,b,c;/float avg;m_avg = 0.0f;m_english = 0;m_yuwen = 0;
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 二零二四年移动应用开发源代码知识产权交易合同3篇
- 专业工作模板业务合作四年计划合同版
- 二零二五年度汽车车身涂装技术合作合同范本
- 二零二四年度新型建筑材料砂石料采购供应合同3篇
- 二零二四年度综合性水利工程土石方施工承包合同3篇
- 2025年度池塘水域环境保护管理服务合同范本2篇
- 2025年度瓷砖生产工艺改进与投资合同4篇
- 二零二五年度存量房买卖合同(附家庭养老设施改造)4篇
- 二零二五年度影视剧本授权拍摄合同
- 氧化铁-铁-石墨烯复合材料的制备及吸波性能的研究
- 小学数学知识结构化教学
- 2022年睾丸肿瘤诊断治疗指南
- 被执行人给法院执行局写申请范本
- 饭店管理基础知识(第三版)中职PPT完整全套教学课件
- 2023年重庆市中考物理A卷试卷【含答案】
- 【打印版】意大利斜体英文字帖(2022年-2023年)
- 2023年浙江省嘉兴市中考数学试题及答案
- 【考试版】苏教版2022-2023学年四年级数学下册开学摸底考试卷(五)含答案与解析
- 《分数的基本性质》数学评课稿10篇
- 第八章 客户关系管理
- 新版人教版高中英语选修一、选修二词汇表
评论
0/150
提交评论