   win32 buttons and WM_command
  With a win32 app and no resource editor I just want to communciate with my UI controls, eg 2 buttons.//how do I know this button is pressed and not another?hBut = CreateWindowEx(WS_EX_CLIENTEDGE, "BUTTON", "Press.. hBut2 = CreateWindowEx(WS_EX_CLIENTEDGE, "BUTTON", "Press..case WM_COMMAND:{int itemID, nNotifyCode;nNotifyCode = HIWORD(wParam);itemID = LOWORD(wParam);if ( nNotifyCode == BN_CLICKED ) if ( itemID == 101 )//this is the problem as 101 comes up for both buttons{MessageBox(NULL,"Winded hbut is defined and is a button but how do we know thta button is pressed or another?every button pressed gets triggered and I can't distinguish between in.PS I didn't think this was so a common question.   
  The ID you receive in WM_COMMAND is one of the parameters you set in CreateWindowEx:HWND CreateWindowEx(DWORD dwExstyle,    LPCTSTR lpClassName,    LPCTSTR lpWindowName,    DWORD dwstyle,    int x,    int y,    int nWidth,    int nHeight,    HWND hWndParent,    -> HMENU hMenu,    HINSTANCE hInstance,    LPVOID lpParam);For a non-child window HMENU is a menu handle. Insert the wanted id (int value) for the button and cast it to HMENU.   ;Quote:Original post by EndurionThe ID you receive in WM_COMMAND is one of the parameters you set in CreateWindowEx:HWND CreateWindowEx(DWORD dwExstyle,    LPCTSTR lpClassName,    LPCTSTR lpWindowName,    DWORD dwstyle,    int x,    int y,    int nWidth,    int nHeight,    HWND hWndParent,    -> HMENU hMenu,    HINSTANCE hInstance,    LPVOID lpParam);For a non-child window HMENU is a menu handle. Insert the wanted id (int value) for the button and cast it to HMENU.ok thanks, I just couldn't get a complete example with this stuff;  jagguy,Also, since you have the HWND's for the buttons you could always perform a comparison of (HWND)lParam with the handle to the button.case WM_COMMAND:{int itemID, nNotifyCode;nNotifyCode = HIWORD(wParam);itemID = LOWORD(wParam);if ( nNotifyCode == BN_CLICKED )if ( hBut == (HWND)lParam ) {MessageBox(NULL,"Winded ...-brad   