Gyannea
October 15th, 2004, 07:51 AM
Why do I get repeat messages to this radio button? What happens in this case is the user clicks on the radio button and the settings are wrong so a message box comes up and informs him of the error and then I make two calls, one to 'uncheck' the button and another to recheck the other button. These calls use the
SendMessage(hwnd, BM_SETCHECK, BST_UNCHECKED, 0); or
SendMessage(hwnd, BM_SETCHECK, BST_CHECKED, 0);
They don't use the BM_CLICK message which is supposed to send a message to the dialog box.
Yet when I run this I get an infinite number of calls to the MessageBox function in
an infinite loop. Why are these calls sending messages to this button? I thought they only effected the button appearance; they didn't go to you message handler.
Code below:
case RADIO_VHF:
if(cycle.cycle != STANDBY || // If engaged in a procedure OR
s->thisradio == VHF) // if already a VHF radio, do nothing
{
break;
}
i = soundcard->GetSamplesPerSecond();
if(i - 1200 * (i / 1200) != 0)
{
MessageBox(hwindow, "Sample rate is not a multiple of the baudrate",
"Error in parameters for VHF", MB_OK);
SendButtonUnchecked(RADIO_VHF); // send button unchecked
SendButtonChecked(RADIO_HF); // Send button checked
break; // Quit since Sample rate is not a multiple of the baud rate
}
..... More code ..... not important
First time I ever used the CODE feature! Hope I did it right.
Why do I get an infinite number of messages to this radio button (only when the sample rate is not a multiple of the baud rate condition happens)?
Thanks,
Brian
SendMessage(hwnd, BM_SETCHECK, BST_UNCHECKED, 0); or
SendMessage(hwnd, BM_SETCHECK, BST_CHECKED, 0);
They don't use the BM_CLICK message which is supposed to send a message to the dialog box.
Yet when I run this I get an infinite number of calls to the MessageBox function in
an infinite loop. Why are these calls sending messages to this button? I thought they only effected the button appearance; they didn't go to you message handler.
Code below:
case RADIO_VHF:
if(cycle.cycle != STANDBY || // If engaged in a procedure OR
s->thisradio == VHF) // if already a VHF radio, do nothing
{
break;
}
i = soundcard->GetSamplesPerSecond();
if(i - 1200 * (i / 1200) != 0)
{
MessageBox(hwindow, "Sample rate is not a multiple of the baudrate",
"Error in parameters for VHF", MB_OK);
SendButtonUnchecked(RADIO_VHF); // send button unchecked
SendButtonChecked(RADIO_HF); // Send button checked
break; // Quit since Sample rate is not a multiple of the baud rate
}
..... More code ..... not important
First time I ever used the CODE feature! Hope I did it right.
Why do I get an infinite number of messages to this radio button (only when the sample rate is not a multiple of the baud rate condition happens)?
Thanks,
Brian