how to identify which button is pushed

This is a discussion on how to identify which button is pushed within the Windows Programming forums, part of the Platform Specific Boards category; Hi, If our window has two BUTTON that how we will identify which button is pushed by the user aswhen ...

  1. #1
    Registered User
    Join Date
    May 2005
    Posts
    19

    how to identify which button is pushed

    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

  2. #2
    x4000 Ruski's Avatar
    Join Date
    Jun 2002
    Location
    Outer Space!
    Posts
    542
    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);
             }
    what does signature stand for?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 06-28-2008, 08:30 PM
  2. elliptical button
    By geek@02 in forum Windows Programming
    Replies: 0
    Last Post: 11-21-2006, 01:15 AM
  3. writing text over a deleted button
    By algi in forum Windows Programming
    Replies: 4
    Last Post: 05-02-2005, 11:32 AM
  4. Window won't display on button command!?
    By psychopath in forum Windows Programming
    Replies: 6
    Last Post: 06-22-2004, 08:12 PM
  5. Disabling "X" button on Window
    By Boomba in forum Windows Programming
    Replies: 3
    Last Post: 06-14-2003, 01:53 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21