Simple menu example using the APIs CreatePopupMenu and AppendMenu.
include DlgBox.inc
.data
DlgBox db 'DLGBOX',0
text1 db 'File',0
text2 db 'Edit',0
text3 db 'Exit',0
text4 db 'Copy',0
.data?
hMenu dd ?
hSubMenu1 dd ?
hSubMenu2 dd ?
.code
start:
invoke GetModuleHandle,0
xor edx,edx
invoke DialogBoxParam,eax,ADDR DlgBox,edx,\
ADDR DlgProc,edx
invoke ExitProcess,eax
DlgProc PROC hWnd:DWORD,uMsg:DWORD,wParam:DWORD,lParam:DWORD
.IF uMsg==WM_INITDIALOG
invoke CreateMenu
mov hMenu,eax
invoke CreatePopupMenu
mov hSubMenu1,eax
invoke AppendMenu,hMenu,MF_POPUP or MF_ENABLED,\
hSubMenu1,ADDR text1
invoke AppendMenu,hSubMenu1,MF_ENABLED,\
IDM_EXIT,ADDR text3
invoke CreatePopupMenu
mov hSubMenu2,eax
invoke AppendMenu,hMenu,MF_POPUP or MF_ENABLED,\
hSubMenu2,ADDR text2
invoke AppendMenu,hSubMenu2,MF_ENABLED,\
IDM_COPY,ADDR text4
invoke SetMenu,hWnd,hMenu
.ELSEIF uMsg==WM_COMMAND
mov eax,wParam
.IF ax==IDM_EXIT
invoke SendMessage,hWnd,WM_CLOSE,0,0
.ENDIF
.ELSEIF uMsg==WM_CLOSE
invoke DestroyMenu,hMenu
invoke EndDialog,hWnd,0
.ELSE
xor eax,eax
ret
.ENDIF
mov eax,1
ret
DlgProc ENDP
END start