Trying to get the return from about 6 check boxes in a
Dialog box.

invoke IsDlgButtonChecked, hDlg, Idc_check1
2
3
etc.

How do I test BST_UNCHECKED or BST_CHECKED to see
if the box in question has a check mark in it.

Hutches examples doesn't cover it. Iczelion doesn't cover it.
Petzolds book doesn't cover it.

Any help would be appreciated.
JPS
Posted on 2002-03-29 20:08:59 by shankle
Hi shankle

IsDlgButtonChecked returns TRUE in eax if checked.



invoke IsDlgButtonChecked, hDlg, Idc_check1
.if eax==TRUE
;Do some stuff
.else
;Do something else
.endif


KetilO
Posted on 2002-03-29 21:23:49 by KetilO
Still can't get it to work. Here is some of my code.

In the RC file created by C++.
Control "Check1", IDC_CHECK1, "Button", BS_AUTOCHECKBOX,
35,50,10,10
this is repeated for the next 6 check boxes with appropriate
changes

In My Program in the MyDlgProc
mov eax, uMsg
.if eax== WM_INITIALOG
.elseif eax== WM_COMMAND
LOWORD wParam
.if eax== IDOK
invoke IsDlgButtonChecked, hDlg, IDC_CHECK1
.if eax== TRUE
mov L1, 1
.endif
etc. about 6 times
invoke EndDialog, hDlg, TRUE
.endif
.else
mov eax, FALSE
ret
.endif
mov eax, TRUE
ret


I have done all the research I can but my sources are limited.

Would appreciate some help
jps
Posted on 2002-03-30 16:29:40 by shankle
Make sure hDlg is the handle to the dialog box. If this is how your dialog message handler looks like:


DlgProc PROC hWnd:DWORD, uMsg:DWORD, wParam:DWORD, lParam:DWORD
change that hDlg to hWnd.

and do something like this:


invoke IsDlgButtonChecked, hWnd, IDC_CHECK1
cmp eax, BST_CHECKED
je @@Checked

...
or
...

.IF eax == BST_CHECKED
other return values you might want to check.

BST_INDETERMINATE
BST_UNCHECKED

You can also send a message to the checkbox control like this:
invoke SendMessage, CheckBoxHandle, BM_GETCHECK, NULL, NULL

...
or
...
invoke SendDlgItemMessage, hWnd, IDC_CHECK1, BM_GETCHECK, NULL, NULL
The return value will either be on of the three stated above.

:)
Posted on 2002-03-30 17:40:38 by stryker