Is it a radio button? In OnCommand
Posted on 2006-11-01
I'm watching for messages in OnCommand, looking for BN_CLICKED and others. I need to know if the BN_CLICKED has been sent by a radio button or something else. How can I do that? I did try the following, but it wasn't successful.
BOOL CMyPage::OnCommand(WPARAM wParam, LPARAM lParam)
WORD lCmdMsg = HIWORD(DWORD(wParam));
if (lCmdMsg == BN_CLICKED)
// Was that a radio or check box button?
CWnd *wnd = GetDlgItem(LOWORD(wParam));
DWORD style = wnd->GetStyle();
if (style & BS_CHECKBOX)
myCBFunc(); // it's a check box
else if (style & BS_RADIOBUTTON)
myRBFunc(); // THIS NEVER GETS HIT
return CPropertyPage::OnCommand(wParam, lParam);