Hello,
Here is a dialog box example displaying radio buttons.
.386
.model flat,stdcall
option casemap:none
include RadioButton.inc
DlgProc PROTO :DWORD,:DWORD,:DWORD,:DWORD
RadioClickProc PROTO :DWORD,:DWORD,:DWORD,:DWORD
IDR_RED equ 4001
IDR_GREEN equ 4002
IDR_BLUE equ 4003
WM_MYCOMMAND equ WM_USER + 1
.data
capt db 'Radio button',0
.data?
hModule dd ?
pOldRadioButton dd ?
hRadioButton dd ?
.code
start:
invoke GetModuleHandle,0
mov hModule,eax
xor ecx,ecx
invoke DialogBoxParam,eax,1001,\
ecx,ADDR DlgProc,ecx
invoke ExitProcess,eax
DlgProc PROC hWnd:DWORD,uMsg:DWORD,wParam:DWORD,lParam:DWORD
.IF uMsg==WM_INITDIALOG
invoke GetDlgItem,hWnd,4001
mov hRadioButton,eax
invoke SetWindowLong,eax,GWLP_WNDPROC,ADDR RadioClickProc
mov pOldRadioButton,eax
invoke GetDlgItem,hWnd,4002
invoke SetWindowLong,eax,GWLP_WNDPROC,ADDR RadioClickProc
invoke GetDlgItem,hWnd,4003
invoke SetWindowLong,eax,GWLP_WNDPROC,ADDR RadioClickProc
invoke SendMessage,hRadioButton,BM_SETCHECK,BST_CHECKED,0
.ELSEIF uMsg==WM_CLOSE
invoke SetWindowLong,hRadioButton,GWLP_WNDPROC,pOldRadioButton
invoke EndDialog,hWnd,0
.ELSEIF uMsg==WM_COMMAND
.IF lParam!=0
invoke SendMessage,lParam,WM_MYCOMMAND,wParam,lParam
.ENDIF
.ELSE
xor eax,eax
ret
.ENDIF
mov eax,1
ret
DlgProc ENDP
RadioClickProc PROC hWnd:DWORD,uMsg:DWORD,wParam:DWORD,lParam:DWORD
.IF uMsg==WM_MYCOMMAND
mov eax,wParam
mov edx,wParam
shr edx,16
.IF dx==BN_CLICKED
.IF ax==IDR_RED
invoke MessageBox,0,@Cstr("RED"),ADDR capt,MB_OK
.ELSEIF ax==IDR_GREEN
invoke MessageBox,0,@Cstr("GREEN"),ADDR capt,MB_OK
.ELSEIF ax==IDR_BLUE
invoke MessageBox,0,@Cstr("BLUE"),ADDR capt,MB_OK
.ENDIF
.ENDIF
.ELSE
invoke CallWindowProc,pOldRadioButton,hWnd,uMsg,wParam,lParam
ret
.ENDIF
xor eax,eax
ret
RadioClickProc ENDP
END start