-
-
Save nasingfaund/6c053eb3f28d7b86b5662206b5385aa4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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