I’m wondering what the correct return value for a windows message loop is. So far I’ve used the following:
case WM_LBUTTONDOWN: // left mouse button pressed.
if (condition == true )
{
do_something();
}
break;
but I’ve seen also things like:
if (IDC_BUTTON == LOWORD(wParam) && BN_CLICKED == HIWORD(wParam))
{
do_something();
return true;
}
break;
which one is correct? Should I return true? or should I break? Does it matter?
EDIT does it depend whether I’m interacting with a button press or a mouse movement?
The return value is documented on MSDN, as part of the documentation for each message. For example, the documentation for WM_LBUTTONDOWN states that
For other messages, the return value might be more meaningful. You should always read the documentation, never guess.