Hi,
If our window has two BUTTON that how we will identify which button is pushed by the user aswhen clicked it send WM_COMMAND
mesage to its parent window.Does button can have ID similar to menu itemin manubar..HOW??????
Regards
Printable View
Hi,
If our window has two BUTTON that how we will identify which button is pushed by the user aswhen clicked it send WM_COMMAND
mesage to its parent window.Does button can have ID similar to menu itemin manubar..HOW??????
Regards
LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
see that line of code? well the Message contains the WM_COMMAND and others stuff.. there are also two parameters.. the wParam and the lParaw.. well the wParam contains the id of the button (or anything else) that recieved a WM_COMMAND message.
For example:
Code:case WM_COMMAND:
switch(LOWORD(wParam))
{
case CM_FILE_OPEN:
DoFileOpenSave(hwnd, FALSE);
break;
case CM_FILE_SAVEAS:
DoFileOpenSave(hwnd, TRUE);
break;
case CM_FILE_EXIT:
PostMessage(hwnd, WM_CLOSE, 0, 0);
break;
case CM_ABOUT:
MessageBox (NULL, "File Editor for Windows !\n Using the Win32 API" , "About...", 0);
}