Original: masm32\example1\filtinpt

.586
.model flat, stdcall
option casemap :none ;case sensitive

;#######################################################################

	include C:\masm32\include\windows.inc
	include C:\masm32\include\user32.inc
	include c:\masm32\include\kernel32.inc
	
	includelib user32.lib
	includelib kernel32.lib

;#######################################################################


	;=====================
	;Local prototypes
	;=====================

WinMain PROTO

WndProc PROTO :DWORD,:DWORD,:DWORD,:DWORD


EditSl  PROTO :DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD
Static  PROTO :DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD
Ed1Proc PROTO :DWORD,:DWORD,:DWORD,:DWORD
Ed2Proc PROTO :DWORD,:DWORD,:DWORD,:DWORD
Ed3Proc PROTO :DWORD,:DWORD,:DWORD,:DWORD

.data
ClassName db 1,0
szDisplayName db "Filtered Input DEMO",0
TheText db "Please Confirm Exit",0
TheMsg db "Assembler, Pure & Simple",0
statClass db "STATIC",0
slEdit db 'EDIT',0
txt1 db 'Numeric',0
txt2 db 'Lcase',0
txt3 db 'Ucase',0

nulbyte db 0

wc WNDCLASSEX 
.data?
hWnd dd ?

hEdit1 dd ?
hEdit2 dd ?
hEdit3 dd ?
lpfnEd1Proc dd ?
lpfnEd2Proc dd ?
lpfnEd3Proc dd ?
msg MSG <>
.code
hInstance equ 400000h
start:
	invoke WinMain

	call ExitProcess

;#############################################################

WinMain  proc uses esi edi ebx
	
xor ebx,ebx

	;==========================================
	;Fill WNDCLASSEX structure with required variabled
	;==========================================

invoke LoadIcon,hInstance,500 ;icon ID
mov wc.hIcon,eax
invoke LoadCursor,ebx,IDC_ARROW
mov wc.hCursor,eax


invoke RegisterClassEx,ADDR wc

	;==============================
	;Center window at the following size
	;==============================
Wwd equ 340
Wht equ 250

	invoke GetSystemMetrics, SM_CXSCREEN
	mov esi,eax

	invoke GetSystemMetrics, SM_CYSCREEN
	shr esi,1
	shr eax,1
	sub eax,Wht/2
	sub esi,Wwd/2
	
invoke CreateWindowEx, WS_EX_OVERLAPPEDWINDOW,
		offset ClassName,
		offset szDisplayName,
		WS_OVERLAPPEDWINDOW or WS_VISIBLE,
		esi,eax,Wwd,Wht,
		ebx,ebx,hInstance,ebx
.IF eax == 0
	invoke GetLastError
.ENDIF

	mov hWnd,eax
	

	;=================================
	;Loop until PostQuiteMessage is sent
	;=================================
mov esi,offset msg
 StartLoop:
	invoke GetMessage,esi,ebx,ebx,ebx
	or eax,eax
	je ExitLoop
	invoke TranslateMessage,esi
	invoke DispatchMessage, esi
	jmp StartLoop
 ExitLoop:
	mov eax,msg.wParam
	ret

WinMain endp

;###########################################################################

WndProc	proc uses esi edi ebx hWin:DWORD,
		uMsg:DWORD,
		wParam:DWORD,
		lParam:DWORD
xor ebx,ebx
mov eax,uMsg
mov esi,hWin

.if eax == WM_COMMAND

;============ menu commands ==================

	.IF wParam == 1
	invoke SendMessage,esi, WM_SYSCOMMAND, SC_CLOSE,ebx
	.ELSEIF wParam == 2
	invoke MessageBox,esi,addr TheMsg, addr szDisplayName,ebx
	.ENDIF

;===========end menu commands ==================

.ELSEIF eax == WM_CREATE
.data
ALIGN 4
txttbl 	dd offset txt1
	dd offset txt2
	dd offset txt3
.code
;--------------------------------------------------------------------------------------------------------------
	mov edi,2
	mov edx,70
	mov eax,502
@@:	
	push edx
	push eax
	invoke CreateWindowEx,WS_EX_STATICEDGE,
	offset statClass,,
	WS_CHILD or WS_VISIBLE or SS_LEFT,
	10,edx,100,22,esi,eax,hInstance,ebx
	pop eax
	pop edx
	dec eax
	sub edx,30
	dec edi
	jns @B
;------------------------------------------------------------------------------------------------------------
.data
align 4
edproctbl dd offset Ed1Proc
	dd offset Ed2Proc
	dd offset Ed3Proc
.code

	mov edi,2
	mov edx,70
	mov eax,202
@@:	push eax
	push edx
	invoke CreateWindowEx,WS_EX_CLIENTEDGE,offset slEdit,ebx,
	WS_VISI
Posted on 2001-04-19 08:27:00 by The Svin