图形界面矩阵计算器

  • u0_233712
    了解作者
  • 388.6KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-06-08 05:54
    上传日期
利用Windows API构建的图形应用程序
2.0.zip
  • 矩阵计算器2.0
  • 矩阵计算器2.0.vcxproj.filters
    1.5KB
  • resource.h
    3.6KB
  • head.h
    11.5KB
  • function.h
    9.9KB
  • Debug
  • cl.command.1.tlog
    646B
  • 矩阵计算器2.0_manifest.rc
    206B
  • link.4376.write.1.tlog
    2B
  • 矩阵计算器2.0.exe.embed.manifest.res
    472B
  • link.5684-cvtres.read.1.tlog
    2B
  • 矩阵计算器2.0.log
    1KB
  • link.2636.write.1.tlog
    2B
  • rc.command.1.tlog
    1KB
  • CL.read.1.tlog
    12.9KB
  • vc100.idb
    387KB
  • mt.read.1.tlog
    318B
  • link.1260.write.1.tlog
    2B
  • link.6012.write.1.tlog
    2B
  • link.4376.read.1.tlog
    2B
  • link.4376-cvtres.read.1.tlog
    2B
  • link.4908-cvtres.read.1.tlog
    2B
  • link-cvtres.read.1.tlog
    2B
  • link.read.1.tlog
    2.9KB
  • link.2848-cvtres.read.1.tlog
    2B
  • rc.read.1.tlog
    2.7KB
  • link.write.1.tlog
    864B
  • link.4776-cvtres.read.1.tlog
    2B
  • 矩阵计算器2.0.lastbuildstate
    92B
  • CL.write.1.tlog
    330B
  • link.2848.write.1.tlog
    2B
  • link.2852-cvtres.read.1.tlog
    2B
  • link.1260-cvtres.write.1.tlog
    2B
  • link.5684-cvtres.write.1.tlog
    2B
  • vc100.pdb
    116KB
  • link.2848.read.1.tlog
    2B
  • link.6404-cvtres.write.1.tlog
    2B
  • link.2852-cvtres.write.1.tlog
    2B
  • link.4776.write.1.tlog
    2B
  • 矩阵计算器2.0.exe.intermediate.manifest
    381B
  • link.5684.read.1.tlog
    2B
  • link.1260-cvtres.read.1.tlog
    2B
  • link.6404.read.1.tlog
    2B
  • link.1260.read.1.tlog
    2B
  • main.obj
    97.3KB
  • link.4776-cvtres.write.1.tlog
    2B
  • link.command.1.tlog
    1.6KB
  • link.6012-cvtres.read.1.tlog
    2B
  • link.5808.read.1.tlog
    2B
  • calculator.res
    265.9KB
  • link.6404.write.1.tlog
    2B
  • link.2852.read.1.tlog
    2B
  • link.6404-cvtres.read.1.tlog
    2B
  • mt.write.1.tlog
    318B
  • link.5808.write.1.tlog
    2B
  • link.2852.write.1.tlog
    2B
  • link.6012.read.1.tlog
    2B
  • 矩阵计算器2.0.exe.embed.manifest
    406B
  • link.6012-cvtres.write.1.tlog
    2B
  • link.5808-cvtres.write.1.tlog
    2B
  • link.4908-cvtres.write.1.tlog
    2B
  • link.4776.read.1.tlog
    2B
  • link.2636.read.1.tlog
    2B
  • mt.command.1.tlog
    392B
  • link.2636-cvtres.read.1.tlog
    2B
  • link.2848-cvtres.write.1.tlog
    2B
  • link.5808-cvtres.read.1.tlog
    2B
  • rc.write.1.tlog
    534B
  • link.5684.write.1.tlog
    2B
  • link-cvtres.write.1.tlog
    2B
  • link.4376-cvtres.write.1.tlog
    2B
  • link.4908.write.1.tlog
    2B
  • link.2636-cvtres.write.1.tlog
    2B
  • link.4908.read.1.tlog
    2B
  • Q
    4B
  • myicon.ico
    264.1KB
  • File0
    292B
  • filename
    44B
  • calculator.rc
    11.9KB
  • 矩阵计算器2.0.vcxproj.user
    143B
  • main.cpp
    10.8KB
  • hadsjfh
    0B
  • Release
  • cl.command.1.tlog
    666B
  • 矩阵计算器2.0.log
    7.8KB
  • rc.command.1.tlog
    532B
  • CL.read.1.tlog
    12.8KB
  • mt.read.1.tlog
    1.4KB
  • link-cvtres.read.1.tlog
    2B
  • link.read.1.tlog
    2.6KB
  • rc.read.1.tlog
    2.4KB
  • link.write.1.tlog
    626B
  • 矩阵计算器2.0.lastbuildstate
    94B
  • CL.write.1.tlog
    338B
  • vc100.pdb
    100KB
  • 矩阵计算器2.0.exe.intermediate.manifest
    381B
  • main.obj
    114.8KB
  • link.command.1.tlog
    1.5KB
  • calculator.res
    265.9KB
  • mt.write.1.tlog
    278B
内容介绍
#include <Windows.h> #include "resource.h" #include "head.h" LRESULT CALLBACK wndprog(HWND,UINT,WPARAM,LPARAM); BOOL CALLBACK inputproc(HWND,UINT,WPARAM,LPARAM); BOOL CALLBACK dlgproc(HWND,UINT,WPARAM,LPARAM); HINSTANCE Hinst; int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd ) { TCHAR szappname[] = TEXT("matrix"); HWND hwnd; MSG msg; WNDCLASS wndclass; wndclass.style = CS_HREDRAW|CS_VREDRAW; wndclass.lpfnWndProc = wndprog; wndclass.cbClsExtra = 0; wndclass.cbWndExtra = DLGWINDOWEXTRA; wndclass.hInstance = hInstance; wndclass.hIcon = LoadIcon(hInstance,MAKEINTRESOURCE(IDI_ICON1)); wndclass.hCursor = LoadCursor(NULL,IDC_ARROW); wndclass.hbrBackground = (HBRUSH)CreateSolidBrush(RGB(0,100,150)); wndclass.lpszMenuName = MAKEINTRESOURCE(IDR_MENU1); wndclass.lpszClassName = szappname; if ( !RegisterClass(&wndclass)) { MessageBox(NULL,TEXT("creat window failed!"),szappname,MB_ICONERROR); return 0 ; } Hinst = hInstance; hwnd = CreateDialog(hInstance,szappname,0,dlgproc); ShowWindow(hwnd,nShowCmd); while( GetMessage(&msg,NULL,0,0)) { TranslateMessage(&msg); DispatchMessage(&msg); } return msg.wParam; } LRESULT CALLBACK wndprog(HWND hwnd,UINT message,WPARAM wparam,LPARAM lparam) { TCHAR *oper[3] = { TEXT("右乘"), TEXT("加"),TEXT("减")} ; static HMENU hmenu ; // 编辑菜单句柄 static Mydata *input = NULL ; // 存入行和列 static filedata *fbase = NULL ; // 维护文件链表 static filedata *ftop = NULL ; static matrix *mbase = NULL ; // 维护矩阵链表 static matrix *mtop = NULL ; static matrix *curmatrix = NULL ; // 当前选中的矩阵 static filedata *curfile = NULL ; //当前选中的文件 TCHAR **filename = NULL ; // 初始化时存储文件名 TCHAR *szbuffer = NULL ; //接收处理后的目标字符串 TCHAR buffer[100] ; POINT pt ; // 追踪鼠标位置 FILE *fp ; char *name = NULL ; int filesum ; // 初始化时记录文件总数 int len ; int index ; switch (message) { case WM_INITDIALOG: { hmenu = LoadMenu(Hinst,MAKEINTRESOURCE(IDR_MENU1)) ; hmenu = GetSubMenu(hmenu,1) ; // 初始化文件链表和矩阵链表 fbase = ftop = (filedata *)malloc(sizeof(filedata)) ; fbase->len = 0 ; fbase->next = NULL ; mbase = mtop = (matrix *)malloc(sizeof(matrix)) ; mbase->row = 0 ; mbase->next = NULL ; input = (Mydata *)malloc(sizeof(Mydata)) ; input->data = NULL ; curfile = (filedata *)malloc(sizeof(filedata)) ; curfile->len = 0 ; curfile->name[0] = '\0' ; // 读取文件名成功则将更新至文件栈和文件列表 if ( filename = getfilenam(&filesum) ) { initfilename(fbase,&ftop,filename,filesum, GetDlgItem(hwnd,IDC_LISTFILE)) ; } // 初始化操作列表和行列选择列表 for ( int i = 0 ; i < 3 ; i++ ) SendMessage(GetDlgItem(hwnd,IDC_LISTOP),LB_INSERTSTRING,i , (LPARAM)oper[i]) ; SendMessage(GetDlgItem(hwnd,IDC_LISTOP),LB_SETCURSEL,0 , 0) ; for ( int i = 0 ; i < 10 ; i++ ) { swprintf(buffer,TEXT("%d"),i+1) ; SendMessage(GetDlgItem(hwnd,IDC_LISTROW),LB_INSERTSTRING,i , (LPARAM)buffer ) ; SendMessage(GetDlgItem(hwnd,IDC_LISTLINE),LB_INSERTSTRING,i , (LPARAM)buffer ) ; } SendMessage(GetDlgItem(hwnd,IDC_LISTROW),LB_SETCURSEL,0 , 0) ; SendMessage(GetDlgItem(hwnd,IDC_LISTLINE),LB_SETCURSEL,0 , 0) ; disablebutton(hwnd) ; } break; case WM_COMMAND: switch(LOWORD(wparam)) { case IDC_BUTTONCREAT: // 处理创建矩阵:计算数据并存入链表 len = GetWindowText(GetDlgItem(hwnd,IDC_EDIT),(LPWSTR)buffer,100); buffer[len] = ' ' ; buffer[len+1] = '\0' ; input->row = 1 + SendMessage(GetDlgItem(hwnd,IDC_LISTROW),LB_GETCURSEL,0,0) ; input->line = 1 + SendMessage(GetDlgItem(hwnd,IDC_LISTLINE),LB_GETCURSEL,0,0) ; // 数据不足或行列的值非法则退出下面的计算步骤 if ( !input->row || !input->line ) { MessageBox(hwnd,TEXT("请选择行和列!"),TEXT("提示"),MB_OK) ; return 0 ; } if ( !(input->data = translateinput(buffer, input)) ) { MessageBox(hwnd,TEXT("您输入的数据不足!\n请核对!"),TEXT("提示"),MB_OK) ; return 0 ; } // 计算矩阵属性并接入链表同时更新到矩阵列表和属性框 pulldata(mbase,&mtop,input) ; updateproperty(hwnd,mtop) ; curmatrix = mtop ; for ( int i = 0 ; i < 3 ; i ++) { SendMessage(GetDlgItem(hwnd,IDC_LISTM1 + i),LB_INSERTSTRING, mbase->row-1,(LPARAM)mtop->name) ; } SendMessage(GetDlgItem(hwnd,IDC_LISTMATRIX),LB_SETCURSEL,mbase->row -1 ,0 ) ; EnableWindow(GetDlgItem(hwnd,IDC_BUTTONOP),TRUE) ; break ; case IDC_BUTTONOP: // 计算矩阵之间的运算--矩阵标号用input的row和line带入 { input->row = SendMessage(GetDlgItem(hwnd,IDC_LISTM1),LB_GETCURSEL,0,0) ; input->line = SendMessage(GetDlgItem(hwnd,IDC_LISTM2),LB_GETCURSEL,0,0) ; int op = SendMessage(GetDlgItem(hwnd,IDC_LISTOP),LB_GETCURSEL,0,0) ; if ( input->row == -1 || input->line == -1) { MessageBox(NULL,TEXT("请选择矩阵"),TEXT("提示"),MB_OK) ; return 0 ; } if ( !calculate(mbase,input,op) ) return 0 ; // 计算矩阵属性并接入链表同时更新到矩阵列表和属性框 pulldata(mbase,&mtop ,input) ; updateproperty(hwnd,mtop) ; curmatrix = mtop ; for ( int i = 0 ; i < 3 ; i ++) { SendMessage(GetDlgItem(hwnd,IDC_LISTM1 + i),LB_INSERTSTRING, mbase->row-1,(LPARAM)mtop->name) ; } SendMessage(GetDlgItem(hwnd,IDC_LISTMATRIX),LB_SETCURSEL,mbase->row-1,0) ; break; } case IDC_BUTTONDATA: // 输出矩阵和它的逆矩阵 case IDC_BUTTONVDATA: szbuffer = outputstring( curmatrix,LOWORD(wparam) - IDC_BUTTONDATA ) ; SetWindowText( GetDlgItem(hwnd,IDC_EDIT),szbuffer ) ; free(szbuffer) ; break ; case IDC_LISTMATRIX: if ( HIWORD(wparam) == LBN_SELCHANGE ) { curmatrix = getmatrix(mbase, SendMessage((HWND)lparam,LB_GETCURSEL,0,0) ) ; updateproperty(hwnd,curmatrix) ; } break ; case IDM_DELCURMATRIX: // 删除当前矩阵 index = SendMessage(GetDlgItem(hwnd,IDC_LISTMATRIX),LB_GETCURSEL,0,0) ; deletematrix(mbase,&mtop, index ) ; curmatrix = mbase->next ; for ( int i = 0 ; i < 3 ; i ++) SendMessage(GetDlgItem(hwnd,IDC_LISTM1 + i ),LB_DELETESTRING, index,0 ) ; if ( SendMessage(GetDlgItem(hwnd,IDC_LISTMATRIX),LB_GETCOUNT,0,0) ) { SendMessage(GetDlgItem(hwnd,IDC_LISTMATRIX),LB_SETCURSEL,0,0 ) ; updateproperty(hwnd,curmatrix) ; } else // 禁用按钮,清空属性框 { emptyproperty( hwnd ) ; EnableWindow(GetDlgItem(hwnd,IDC_BUTTONDATA),FALSE) ; EnableWindow(GetDlgItem(hwnd,IDC_BUTTONVDATA),FALSE) ; EnableWindow(GetDlgItem(hwnd,IDC_BUTTONOP),FALSE) ; } break ; case IDM_DELCURFILE: // 删除当前选中的文件 if ((index = SendMessage(GetDlgItem(hwnd,IDC_LISTFILE),LB_GETCURSEL,0,0) )== -1 ) return 0 ; SendMessage(GetDlgItem(hwnd,IDC_LISTFILE),LB_DELETESTRING,index,0) ; deletefile(fbase,&ftop,index) ; emptymatrix(mbase) ; mtop = mbase ; emptyproperty(hwnd) ; disablebutton(hwnd) ; for ( int i = 0 ; i < 3 ; i ++) SendMessage(GetDlgItem(hwnd,IDC_LISTM1 + i),LB_RESETCONTENT,0,0) ; break ; case ID_FILE_NEW40001: if ( szbuffer ) { free(szbuffer) ; szbuffer = NULL ; } DialogBoxParam(Hinst,MAKEINTRESOURCE(IDD_DLGNAME),hwnd, inputproc,(LPARAM)(&szbuffer)) ; if ( !szbuffer) return 0 ; name = TCHARtochar(szbuffer) ; lstrcpy(curfile->name , szbuffer) ; curfile->len = lstrlen(szbuffer) ; if ( !(fp = (fopen(name,"wb+")))) { MessageBox(NULL,TEXT("数据存入失败!"),TEXT("提示"),MB_OK) ; return 0; } // 清空数据禁用按钮 emptymatrix(mbase) ; mtop = mbase ; disablebutton(hwnd) ; for ( int i = 0 ; i < 3 ; i ++)
评论
    相关推荐
    • 混淆矩阵
      混淆矩阵
    • LED矩阵-项目开发
      使用Windows远程Arduino库在Windows Phone上拍照并以48x48 RGB LED矩阵显示它们。
    • 并行矩阵乘法
      基于Pthread的多线程并行矩阵乘法,包含1000*1000矩阵随机矩阵生成代码,和串行矩阵乘法的比较,c++实现,Windows系统。
    • 矩阵计算器
      能够实现矩阵加减乘运算,幂运算,数乘运算,转置,行列式,逆矩阵。 能够检测矩阵是否完整,能够识别是否能进行所选择的运算,并且提示出不能进行计算的原因。
    • windows下多线程编程完成矩阵乘法
      windows下多线程编程完成矩阵乘法,从而提高效率
    • matrix:电影中看到的绿色,“矩阵”密码的小巧,快速,优雅的Windows屏幕保护程序
      矩阵屏保 描述: Matrix屏幕保护程序是电影中看到的绿色“ Matrix”密码代码的小型,快速且优雅的Windows版本。 最初由J Brown于2003年撰写。 网站: 支持: (c)2011-2021亨利++
    • 矩阵计算器
      可以实现矩阵的加、减、数乘、乘、转置等功能,语言为C++,使用类定义,运用面向对象方法
    • 矩阵运算工具
      产品版本号:矩阵运算工具3.0 试用版 矩阵运算工具,是帷幄软件的核心产品,又称帷幄矩阵运算工具。 矩阵运算工具1.0和2.0为内部测试版本,矩阵运算工具3.0 现在推出试用版。 官方网站:...
    • Taucs-大型稀疏矩阵计算库
      目前最快的大型稀疏矩阵计算库。已经预编译好了lib文件,可以在windows上直接使用。
    • GaussDB_100_1.0.1-DATABASE-REDHAT-64bit.tar.gz
      guassdb100在redhat上安装包,单机部署的包,安装步骤请看我的文中介绍,经过大量实验搭建总结出来的文档