Checkbox feedback problem.

Started by
3 comments, last by mrmrcoleman 18 years, 3 months ago
Hello, I have a simple dialog box (WIN32) which has a checkbox on it. When the user clicks on the checkbox I intercept the message in the dialog box's message procedure and then try to get the current state like this. PRINTER_CONNECTED = (int)SendMessage(hwndPrinterConnected, BM_GETCHECK, 0, 0); Unfortunately this only works when I am unchecking the box (i.e. Change PRINTER_CONNECTED from 1 to 0), when I recheck the box the output from this call is always 0. Any ideas? Thanks in advance. Mark
Advertisement
The previous post was very badly worded. Basically this call:

PRINTER_CONNECTED = (int)SendMessage(hwndPrinterConnected, BM_GETCHECK, 0, 0);

Only ever returns 0 even though I can see that the checkbox it is querying is changing state.

Thanks in advance for any help on this.

Mark
Quote:From MSDN:
Check State
The check state applies to a check box, radio button, or three-state check box, but does not apply to other buttons. The state can be checked, cleared, or (for three-state check boxes) indeterminate. A check box is checked when it contains a check mark, and is cleared when it does not. A radio button is checked when it contains a black dot; and is cleared when it does not. A three-state check box is checked when it contains a check mark, is cleared when it does not, and is indeterminate when it contains a grayed box. The system automatically changes the check state of an automatic button, but the application must change the check state of a non-automatic button.


Try changing the style of the window to BS_AUTOCHECKBOX, if you haven't done that already, and see what happens.

Source: MSDN Button Overview / Button States
Thats the problem, the AUTO style is already checked. I just don't understand what is happening here. I am happy to switch off auto and do it myself but I would rather solve the problem.

What extra information would I have post here to better explain the problem?

Mark
Does anybody have any source for a simple program which implements a checkbox? I could probably establish the problem more quickly with something to work from.

Mark

This topic is closed to new replies.

Advertisement