Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
format PE64 GUI 5.0
entry WinMain
include 'includes\win64a.inc'
section '.text' code readable writeable executable
_title TCHAR 'Iczelion Tutorial #3:The Simplest Window in FASM',0 ;name of our window
wc WNDCLASSEX sizeof.WNDCLASSEX,0,WindowProc,0,0,400000h,0,10003h,COLOR_WINDOW,NULL,_title,NULL
proc WinMain
local msg:MSG
invoke RegisterClassEx,wc
mov edi,_title
mov esi,CW_USEDEFAULT
invoke CreateWindowEx,0,edi,edi,WS_OVERLAPPEDWINDOW+WS_VISIBLE,\
esi,esi,esi,esi,NULL,NULL,400000h,NULL
lea edi,[msg]
message_loop: invoke GetMessage,edi,NULL,0,0
invoke DispatchMessage,edi
jmp message_loop
endp
; +----------------------+
; | the window procedure |
; +----------------------+
proc WindowProc hwnd,wmsg,wparam,lparam
cmp edx,WM_DESTROY
je wmDESTROY
leave
jmp [DefWindowProc]
wmDESTROY: invoke ExitProcess,NULL
endp
data import
library KERNEL32, 'KERNEL32.DLL',\
user32, 'USER32.DLL'
import KERNEL32,\
ExitProcess, 'ExitProcess'
import user32,\
RegisterClassEx, 'RegisterClassExA',\
CreateWindowEx, 'CreateWindowExA',\
DefWindowProc, 'DefWindowProcA',\
GetMessage, 'GetMessageA',\
DispatchMessage, 'DispatchMessageA'
end data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.