资源描述:
《《开发工具》实验指导书》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、《开发工具》实验指导书信息学院2010年4月实验1:各种WINDOWS应用软件开发工具的比实验目的:理解各种windows开发工貝的本质,比较它们的特点实验内容:用三种开发工具设计并实现4种“hello”程序。开发工具分别为VC++6.0,VB6.0,DELPHI7.0实验步骤:1.基于WINDOWSAPI的“hello”程序。使用VC++6.0建立Win32Application类工程,直接利用WINDOWSAPI编程。程序运行后直接在窗体显示“HelloWorld”字样。注意在“WM_PAINT”消息屮处理显示“HelloWorld”。HelloWor
2、ld!setoFo»tReader%Protd99S6BtCoen0704132CC20CO)Kol^aanSAm>r4.Cusb20emur$t图1.1基于WINDOWSAPI的“hello”程序运行结果关键代码://windowsApiHELLO.cpp:Definestheentrypointfortheapplication.//#includeMstdafx.hH#includcnresource.hM#defineMAX_LOADSTRING100ooooooooLRESULTCALLBACKWndProc(HWNDhWnd,UINTmessa
3、ge,WPARAMwParam,LPARAMIParam){intwmld,wmEvent;PAINTSTRUCTps;HDChdc;TCHARszHcllo[MAX_LOADSTRING];LoadString(hInst,IDS_HELLO,szHello,MAX_LOADSTRING);switch(message){easeWM_COMMAND:wmld=LOWORD(wParam);wmEvent=HIWORD(wParam);//Parsethemenuselections:switch(wmld){caseIDM_ABOUT:DialogBo
4、x(hlnst,(LPCTSTR)IDD_ABOUTBOX,hWnd,(DLGPROC)About);break;caseIDM_EXIT:DestroyWindow(hWnd);break;default:returnDefWindowProc(hWnd,message,wParam,IParam);}break;caseWM_PAINT:hdc=BeginPaint(hWnd,&ps);//TODO:Addanydrawingcodehere...RECTrt;GetClientRect(hWnd,&rt);DrawText(hdc,szHello,s
5、trlen(szHello),&「t,DT_CENTER);EndPaint(hWnd,&ps);break;caseWM_DESTROY:PostQuitMcssagc(O);break;default:returnDefWindowProc(hWnd,message,wParam,IParam);)return0;}1.基于VC++MFC的“hello,,程序。使用VC++6.0建立MFCAppwizard(exe)工程,选择对话框类型的代码框架,实现如下功能(1)程序运行后出现的界面图1.2」基于VC卄的“hello”程序运行结果(2)用户点击“Bu
6、ttonl”后的界面图1.2.2基于VC++的“hello”程序运行结果注意:文本框与变虽:的对应;文本框内数据的更新附录:关键代码voidCVCMFCHELLODlg::DoDataExchange(CDataExchange*pDX){CDialog::DoDataExchangc(pDX);//{{AFX_DATA_MAP(CVCMFCHELLODlg)DDX_Text(pDX,IDC.EDITl,m_Editl);//}}AFX_DATA_MAPBEGIN_MESSAGE_MAP(CVCMFCHELLODlg,CDialog)//{{AFX_MSG
7、_MAP(CVCMFCHELLODlg)ON_WM_SYSCOMMAND()ON_WM_PAINT()ON_WM_QUERYDRAGICON()ON_BN_CLICKED(IDC_BUTTON1,OnButton1)〃}}AFX_MSG_MAPEND_MESSAGE_MAP()lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllvoidCVCMFCHELLODlg::OnButton1(){//TODO:Addyourcontrolnotification
8、handlercodeherem_Editl二”HELLO!”;U