窗口程序

窗口程序_第1张图片
窗口程序_第2张图片

.386

.model flat,stdcall

option casemap:none

include windows.inc

include masm32.inc

include kernel32.inc

include user32.inc

includelib masm32.lib

includelib kernel32.lib

includelib user32.lib

.data

IDD_DLG_MAIN equ 1000

IDC_EDT_FIRST equ 1001

IDC_EDT_SECOND equ 1002

IDC_EDT_OUTPUT equ 1003

IDC_BTN_OUTPUT equ 1004

IDC_BTN_EXITAPP equ 1005

szExitApp db "你真的要退出吗",0

szTitle  db "对话框程序",0

szFmt    db "%s%s",0

hInstance dd ?

.code

DlgProc proc uses ebx esi edi hwnd,uMsg,wParam,lParam

LOCAL @szBuffer1[256]:byte

LOCAL @szBuffer2[256]:byte

LOCAL @szOutputBuf[512]:byte

mov eax,uMsg

.if eax == WM_INITDIALOG

;comment *

invoke RtlZeroMemory,addr @szBuffer1,sizeof @szBuffer1

invoke RtlZeroMemory,addr @szBuffer2,sizeof @szBuffer2

invoke RtlZeroMemory,addr @szOutputBuf,sizeof @szOutputBuf

;*

.elseif eax == WM_COMMAND

;comment *

mov eax,wParam

.if ax ==IDC_EDT_FIRST

.elseif ax == IDC_EDT_SECOND

.elseif ax == IDC_BTN_OUTPUT

invoke GetDlgItemText,hwnd,IDC_EDT_FIRST,addr @szBuffer1,sizeof @szBuffer1

invoke GetDlgItemText,hwnd,IDC_EDT_SECOND,addr @szBuffer2,sizeof @szBuffer2

invoke wsprintf,addr @szOutputBuf,addr szFmt,addr @szBuffer1,addr @szBuffer2

invoke SetDlgItemText,hwnd,IDC_EDT_OUTPUT,addr @szOutputBuf

.elseif ax == IDC_BTN_EXITAPP

invoke SendMessage,hwnd,WM_CLOSE,0,0

.endif

;*

.elseif eax == WM_CLOSE

;comment *

invoke MessageBox,hwnd,addr szExitApp,addr szTitle,MB_YESNO

.if al == IDYES

invoke EndDialog,hwnd,NULL

.endif

mov eax,FALSE

ret

;*

.else

mov eax,FALSE

ret

.endif

mov eax,TRUE

ret

DlgProc endp

start:

invoke GetModuleHandle,NULL

mov hInstance,eax

invoke DialogBoxParam,hInstance,IDD_DLG_MAIN,NULL,offset DlgProc,NULL

invoke ExitProcess,0

end start

--------------

wtf,TAB都给吃了啊

你可能感兴趣的:(窗口程序)