voilà :
..start:
push 0
call [GetModuleHandleA]
mov [wc.hInstance], eax
push IDI_APPLICATION
push 0
call [LoadIconA]
mov [wc.hIcon],eax
mov [wc.hIconSm],eax
push IDC_ARROW
push 0
call [LoadCursorA]
mov [wc.hCursor],eax
push wc
call [RegisterClassExA]
push NULL
push dword [wc.hInstance]
push NULL
push NULL
push 205
push 190
push CW_USEDEFAULT
push CW_USEDEFAULT
push WS_OVERLAPPEDWINDOW
push window_name
push nom_classe
push NULL
call [CreateWindowExA]
mov [handle_fenetre],eax
push SW_SHOWDEFAULT
push eax
call [ShowWindow]
push dword [handle_fenetre]
call [UpdateWindow]
boucle_msg:
push 0
push 0
push NULL
push message
call [GetMessageA]
test eax,eax
jz .fin_boucle
cmp eax,-1
je .fin_boucle
push message
call [TranslateMessage]
push message
call [DispatchMessageA]
jmp boucle_msg
.fin_boucle:
push dword [message.wParam]
call [ExitProcess]
procedure_de_fenetre :
mov ebp,esp
cmp dword [ebp+8],WM_DESTROY
jne .pas_quitter
push dword [hbitmap]
call [DeleteObject]
push 0
call [PostQuitMessage]
xor eax,eax
ret
.pas_quitter :
cmp dword [ebp+8],WM_CREATE
jne .pas_create
push dword IDB_NOEL
push dword [wc.hInstance]
call [LoadBitmapA]
mov [hbitmap],eax
xor eax,eax
ret
.pas_create :
cmp dword [ebp+8],WM_PAINT
jne near .defaut
push ps
push dword [ebp+4] ; hWnd
call [BeginPaint]
mov [hdc],eax
push eax
call [CreateCompatibleDC]
mov [hmemdc],eax
push dword [hbitmap]
push dword [hmemdc]
call [SelectObject]
push rect
push dword [ebp+4]
call [GetClientRect]
push 13369376;SRCCOPY
push 0
push 0
push dword [hmemdc]
push dword [rect+12]
push dword [rect+8]
push 15
push 15
push dword [hdc]
call [BitBlt]
push dword [hmemdc]
call [DeleteDC]
push ps
push dword [ebp+4]
call [EndPaint]
xor ax,ax
ret
.defaut:
push dword [ebp+16]
push dword [ebp+12]
push dword [ebp+8]
push dword [ebp+4]
call [DefWindowProcA]
ret
.fin :
[section .data class=DATA]
wc:
.cbSize dd .fin_wc-wc
.style dd CS_HREDRAW | CS_VREDRAW
.lpfnWndProc dd procedure_de_fenetre
.cbClsExtra dd NULL
.cbWndExtra dd NULL
.hInstance dd 0
.hIcon dd 0
.hCursor dd 0
.hbrBackground dd COLOR_WINDOW +1 ; et sans le +1 ?
.lpszMenuName dd NULL
.lpszClassName dd nom_classe
.hIconSm dd 0
.fin_wc
nom_classe db 'SimpleWinClass',0
window_name db 'NOEL VAINCRA !',0
[section .bss]
hbitmap resd 1
hdc resd 1
ps resd 9
rect resd 4
hmemdc resd 1
handle_fenetre resd 1
message:
.hwnd resd 1
.message resd 1
.wParam resd 1
.lParam resd 1
.time resd 1
.pt resd 1
preuve :
http://img81.imageshack.uck.us/my.php?image=scrnor8.jpg
j'ai traîné parce que le programme ne fonctionnait pas avec une image plus grande que 150x150, j'ai toujours pas compris pourquoi 