Problem with comparing variables

I have a STRUCT that looks like this:

      struct ckBoxes
            bool      left;
            bool      right;
            bool      middle;
            bool      none;


one of my variables is:

expected.left = true;

and ...

I need to compare that to a checkbox control:

long lLeft = SendDlgItemMessage( hWndDlg, IDC_CK_LEFT, BM_GETCHECK, 0, 0 );

Question is, how do I see if expected.left = my IDC_CK_LEFT ??

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Test the returned value:

if (BST_CHECKED == lLeft && expected.left) {

  // ...

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
edvinsonAuthor Commented:
Great! That gets the points, but could you help me with something else real quick...

How would I check lRight lMiddle and lNone too?

Like in one line would be good,

Would this do it:

if (BST_CHECKED == lLeft && expected.left && lRight && expected.right && ....) {

some may be false, like expected.none is almost always false.

For that you'll neex to query the individual controls, e.g.

if (BST_CHECKED SendDlgItemMessage( hWndDlg, IDC_CK_RIGHT, BM_GETCHECK, 0, 0 ) == && expected.right) {

  // ...

if (BST_CHECKED SendDlgItemMessage( hWndDlg, IDC_CK_MIDDLE, BM_GETCHECK, 0, 0 ) == && expected.middle) {

  // ...

If none of the three above applies, 'expected.none' is 'true'
edvinsonAuthor Commented:
terrific, thanks jkr. top notch answers, as always.
Except that I forgot the '==' in

if (BST_CHECKED == SendDlgItemMessage( hWndDlg, IDC_CK_RIGHT, BM_GETCHECK, 0, 0 ) == && expected.right) {

  // ...

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.