can you use switch case in the WM_COMMAND message instead of if in C and API?
if so how would you do this, thanks
can you use switch case in the WM_COMMAND message instead of if in C and API?
if so how would you do this, thanks
Of course u can use switch statements:
eg:-
switch(&msg)
{
case WM_COMMAND:
{
case 1: //Add cases such as button clicks
//Add code here
}
}
I'm new 2 the subject. apologies if something gets wrong
here ill explain what i mean
with if you use say
if((HWND)lParam == hwndButton){....
is there a way with switch case so you can case hwndButton like this.
case hwndButton:
or something like that
Where's the problem? Example:
Code:switch (uMsg) { case WM_COMMAND: WORD wCtrlID = LOWORD(wParam); WORD wNotify = HIWORD(wParam); if (lParam) // Control switch (wCtrl) { case IDC_BUTTON1: if (wNotify == BN_CLICKED) DoStuff(); break; case IDC_BUTTON2: if (wNotify == BN_CLICKED) DoStuff(); break; case IDC_BUTTON2: if (wNotify == BN_CLICKED) DoStuff(); break; } else // Menu { } return 0; case WM_DESTROY: PostQuitMessage(0); return 0; }