Sign in to follow this  

Checkbox feedback problem.

This topic is 4352 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

This topic is 4352 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this