.386
.model flat, stdcall
option casemap:none
include kernel32.inc
includelib kernel32.lib
include windows.inc
include user32.inc
includelib user32.lib
includelib gdi32.lib
include gdi32.inc
DlgProc Proto :DWORD, :DWORD, :DWORD, :DWORD
.Data
WindowTitle db "This is the text of our window",0
EditText db "This is the text of the editbox",0
icon equ 1
cursor equ 2
font LOGFONT <-18,0,0,0,FW_NORMAL, FALSE, FALSE,FALSE,0,3,2,1,34,"Impact">
.Data?
hInstance HINSTANCE ?
hCursor dd ?
hFont dd ?
hBrush dd ?
.Const
.Code
Start:
invoke GetModuleHandle, NULL
mov hInstance, eax
invoke DialogBoxParam, hInstance, 1001, NULL, Addr DlgProc, NULL
invoke ExitProcess,0
DlgProc Proc hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
.if uMsg == WM_COMMAND
mov eax, wParam
.if eax == 1003
.elseif eax == 1004
invoke SendMessage, hWnd, WM_CLOSE, 0, 0
.endif
.elseif uMsg == WM_INITDIALOG
invoke SetWindowText, hWnd, Addr WindowTitle
invoke SetDlgItemText, hWnd, 1002, Addr EditText
invoke LoadImage, hInstance, icon,IMAGE_ICON, 0, 0, LR_SHARED
invoke SendMessage, hWnd, WM_SETICON, ICON_SMALL,eax
invoke LoadImage, hInstance, cursor, IMAGE_CURSOR, 0, 0, LR_SHARED
mov hCursor, eax
invoke CreateFontIndirect, Addr font
mov hFont, eax
invoke GetDlgItem, hWnd, 1002
invoke SendMessage, eax, WM_SETFONT, hFont, 0
invoke CreateSolidBrush, 13447834
mov hBrush,eax
invoke GetDlgItem, hWnd, 1003
invoke EnableWindow, eax, TRUE
.elseif uMsg == WM_CTLCOLORDLG
mov eax, hBrush
ret
.elseif uMsg == WM_CTLCOLOREDIT
invoke SetTextColor, wParam, Red
invoke SetBkMode, wParam, TRANSPARENT
invoke GetSysColorBrush, COLOR_WINDOW
ret
.elseif uMsg == WM_SETCURSOR
invoke SetCursor, hCursor
.elseif uMsg == WM_CLOSE
invoke EndDialog, hWnd, NULL
.else
mov eax, FALSE
ret
.endif
mov eax, TRUE
ret
DlgProc endp
End Start
Recommended Comments
There are no comments to display.