|
本身想写个计算器,但是由于EDIT控件方面不懂,所以写个这小程序,见笑了.(诚心找个WIN32汇编老师指导,有愿意的联系QQ:97383723)!
下面发下代码 子窗口控件定义.rc:
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
#include <resource.h>
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
#define ICO_MAIN 0x1000 //图标
#define DLG_MAIN 1
#define IDC_TEXT 1000 //编辑框1
#define IDC_TEXT2 1001 //编辑框2
#define IDC_LTEXT 1002 //标签
#define IDC_TEXT3 1003 //编辑框3
#define IDC_TEXT4 1004 //编辑框4
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ICO_MAIN ICON "Main.ico"
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
DLG_MAIN DIALOG 50, 50, 150, 150
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "排序"
FONT 9, "宋体"
{
EDITTEXT IDC_TEXT,65,14,50,15 //文本框1
EDITTEXT IDC_TEXT2,10,14,50,15 //文本框2
EDITTEXT IDC_TEXT3,65,74,50,15 //文本框3
EDITTEXT IDC_TEXT4,10,74,50,15 //文本框4
DEFPUSHBUTTON "排序", IDOK, 50, 40, 30, 14 //按钮等于
LTEXT "点按钮进行排序",IDC_LTEXT,30,55,100,14
}
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
.ASM文件:
.386
.model flat, stdcall
option casemap :none
include windows.inc
include user32.inc
includelib user32.lib
include kernel32.inc
includelib kernel32.lib
ICO_MAIN equ 1000h ;图标
DLG_MAIN equ 1
IDC_TEXT equ 1000 ;编辑框1
IDC_TEXT2 equ 1001 ;编辑框2
IDC_LTEXT EQU 1002
IDC_TEXT3 equ 1003
IDC_TEXT4 equ 1004
.data?
hInstance dd ?
lpshuju dd 0
lpshuju1 dd 0
.code
_ProcDlgMain proc uses ebx edi esi hWnd,wMsg,wParam,lParam
local @szbuffer[128]:BYTE
mov eax,wMsg
.if eax == WM_CLOSE
invoke EndDialog,hWnd,NULL
.elseif eax == WM_INITDIALOG
invoke LoadIcon,hInstance,ICO_MAIN
invoke SendMessage,hWnd,WM_SETICON,ICON_BIG,eax
.elseif eax == WM_COMMAND
mov eax,wParam
.if ax == IDOK
invoke GetDlgItemInt,hWnd,IDC_TEXT2,offset lpshuju,FALSE ;读取文本框2的内容
mov lpshuju1,eax
invoke GetDlgItemInt,hWnd,IDC_TEXT,offset lpshuju,FALSE ;读取文本框1的内容
mov ecx,eax
.if lpshuju > ecx
invoke SetDlgItemInt,hWnd,IDC_TEXT3,ecx,FALSE
invoke SetDlgItemInt,hWnd,IDC_TEXT4,lpshuju1,FALSE
.elseif lpshuju < ecx
invoke SetDlgItemInt,hWnd,IDC_TEXT4,ecx,FALSE
invoke SetDlgItemInt,hWnd,IDC_TEXT3,lpshuju1,FALSE
.endif
.endif
.else
mov eax,FALSE
ret
.endif
mov eax,TRUE
ret
_ProcDlgMain endp
start:
invoke GetModuleHandle,NULL
mov hInstance,eax
invoke DialogBoxParam,hInstance,DLG_MAIN,NULL,offset _ProcDlgMain,NULL
invoke ExitProcess,NULL
end start
最后做成软件图|片如下:
所有东西.rar
(2.73 KB, 下载次数: 5)
|
|