Thank you Vortex.
I have rewritten the main message loop like this :
ALIGN 16
@MsgLoop :
lea rcx,_Msg
xor rdx,rdx
xor r8,r8
xor r9,r9
call GetMessageA
test rax,rax
jz @MsgLoopEnd
mov rax,OFFSET hDlgFiles
lea rdx,_Msg
mov rcx,[rax]
call IsDialogMessage
test rax,rax
jnz @MsgLoop
mov rax,OFFSET hWndMain
mov rdx,OFFSET hAccel
mov rcx,[rax]
mov rdx,[rdx]
lea r8,_Msg
call TranslateAccelerator
test rax,rax
jnz @MsgLoop
lea rcx,_Msg
call TranslateMessage
mov rax,OFFSET @MsgLoop
lea rcx,_Msg
push rax
jmp DispatchMessageA
ALIGN 16
@MsgLoopEnd :
mov rax,_Msg.wParam
ret