windows加法计算器

上传人:xiao****1972 文档编号:84090083 上传时间:2019-03-02 格式:DOC 页数:11 大小:195.50KB
返回 下载 相关 举报
windows加法计算器_第1页
第1页 / 共11页
windows加法计算器_第2页
第2页 / 共11页
windows加法计算器_第3页
第3页 / 共11页
windows加法计算器_第4页
第4页 / 共11页
windows加法计算器_第5页
第5页 / 共11页
点击查看更多>>
资源描述

《windows加法计算器》由会员分享,可在线阅读,更多相关《windows加法计算器(11页珍藏版)》请在金锄头文库上搜索。

1、实验报告1 任务概述(任务说明) 设计一个计算器2设计思路(包括技术基础等) 先画出文本框EDIT,在画出按键BUTTON,接受数据后再转换成数据类型int,最后将运算后的结果又粘贴到文本框中。3程序结构描述4源码,文档化加法计算器.h#pragma once#include resource.hResource.h/NO_DEPENDENCIES/ Microsoft Visual C+ generated include file./ Used by 加法计算器.rc/#define IDS_APP_TITLE103#define IDC_EDIT1 1001#define IDC_EDI

2、T2 1002#define IDC_EDIT3 1003#define IDC_BUTTON1 1004#define IDC_BUTTON2 1005#define IDC_BUTTON3 1006#define IDC_BUTTON4 1007#define IDR_MAINFRAME128#define IDD_MY_DIALOG102#define IDD_ABOUTBOX103#define IDM_ABOUT104#define IDM_EXIT105#define IDI_MY107#define IDI_SMALL108#define IDC_MY109#define IDC

3、_MYICON2#ifndef IDC_STATIC#define IDC_STATIC-1#endif/ 新对象的下一组默认值/#ifdef APSTUDIO_INVOKED#ifndef APSTUDIO_READONLY_SYMBOLS#define _APS_NO_MFC130#define _APS_NEXT_RESOURCE_VALUE129#define _APS_NEXT_COMMAND_VALUE32771#define _APS_NEXT_CONTROL_VALUE1000#define _APS_NEXT_SYMED_VALUE110#endif#endif#define

4、 IDI_CALWINAPI107#define IDI_SMALL108#define IDC_CALWINAPI109#define IDC_MYICON2#ifndef IDC_STATIC#define IDC_STATIC-1#define IDC_EDIT1 1001#define IDC_EDIT2 1002#define IDC_EDIT3 1003#define IDC_BUTTON1 1004#define IDC_BUTTON2 1005#define IDC_BUTTON3 1006#define IDC_BUTTON4 1007#endif加法计算器.cpp/ 加法计

5、算器.cpp : 定义应用程序的入口点。/#include stdafx.h#include #include Resource.h#define MAX_LOADSTRING 100/ 全局变量:HINSTANCE hInst;/ 当前实例TCHAR szTitleMAX_LOADSTRING;/ 标题栏文本TCHAR szWindowClassMAX_LOADSTRING;/ 主窗口类名/ 此代码模块中包含的函数的前向声明:ATOMMyRegisterClass(HINSTANCE hInstance);BOOLInitInstance(HINSTANCE, int);LRESULT CA

6、LLBACKWndProc(HWND, UINT, WPARAM, LPARAM);INT_PTR CALLBACKAbout(HWND, UINT, WPARAM, LPARAM);int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)UNREFERENCED_PARAMETER(hPrevInstance);UNREFERENCED_PARAMETER(lpCmdLine); / TODO: 在此放置代码。MSG msg;HACCEL hAcce

7、lTable;/ 初始化全局字符串LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);LoadString(hInstance, IDC_MY, szWindowClass, MAX_LOADSTRING);MyRegisterClass(hInstance);/ 执行应用程序初始化:if (!InitInstance (hInstance, nCmdShow)return FALSE;hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_MY);/ 主

8、消息循环:while (GetMessage(&msg, NULL, 0, 0)if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)TranslateMessage(&msg);DispatchMessage(&msg);return (int) msg.wParam;ATOM MyRegisterClass(HINSTANCE hInstance)WNDCLASSEX wcex;wcex.cbSize = sizeof(WNDCLASSEX);wcex.style= CS_HREDRAW | CS_VREDRAW;wcex.lpfnWn

9、dProc= WndProc;wcex.cbClsExtra= 0;wcex.cbWndExtra= 0;wcex.hInstance= hInstance;wcex.hIcon= LoadIcon(hInstance, MAKEINTRESOURCE(IDI_MY);wcex.hCursor= LoadCursor(NULL, IDC_ARROW);wcex.hbrBackground= (HBRUSH)(COLOR_WINDOW+1);wcex.lpszMenuName= MAKEINTRESOURCE(IDC_MY);wcex.lpszClassName= szWindowClass;w

10、cex.hIconSm= LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL);return RegisterClassEx(&wcex);BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) HWND hWnd; hInst = hInstance; / 将实例句柄存储在全局变量中 hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL,

11、 NULL, hInstance, NULL); if (!hWnd) return FALSE; ShowWindow(hWnd, nCmdShow); UpdateWindow(hWnd); return TRUE;LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)int wmId, wmEvent;PAINTSTRUCT ps;HDC hdc;static HWND hEdit1,hEdit2,hResult1,hButton1,hStatic1,hStatic2;static H

12、WND hEdit3,hEdit4,hResult2,hButton2,hStatic3,hStatic4;static HWND hEdit5,hEdit6,hResult3,hButton3,hStatic5,hStatic6;static HWND hEdit7,hEdit8,hResult4,hButton4,hStatic7,hStatic8;switch (message)case WM_CREATE:hEdit1=:CreateWindowA(EDIT,NULL,WS_CHILD | WS_VISIBLE|WS_BORDER ,30,30,100,20,hWnd,(HMENU)

13、IDC_EDIT1,hInst,NULL);hEdit2=:CreateWindowA(EDIT,NULL,WS_CHILD | WS_VISIBLE|WS_BORDER ,230,30,100,20,hWnd,(HMENU) IDC_EDIT2,hInst,NULL);hEdit3=:CreateWindowA(EDIT,NULL,WS_CHILD | WS_VISIBLE|WS_BORDER ,30,130,100,20,hWnd,(HMENU) IDC_EDIT3,hInst,NULL);hEdit4=:CreateWindowA(EDIT,NULL,WS_CHILD | WS_VISIBLE|WS_BORDER ,230,130,100,20,hWnd,(HMENU) IDC_EDIT1,hInst,NULL);hEdit5=:CreateWindowA(EDIT,NULL,WS_CHILD | WS_VISIBLE|WS_BORDER ,30,230,100,20,hWnd,(HMENU) IDC_ED

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 大杂烩/其它

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号