how do i check which button is pressed ?

This is a discussion on how do i check which button is pressed ? within the Windows Programming forums, part of the Platform Specific Boards category; Hi All, I have a quetion. I am using VC++ where i am getting values from the GUI controls using ...

  1. #1
    Registered User intruder's Avatar
    Join Date
    Nov 2002
    Posts
    48

    how do i check which button is pressed ?

    Hi All,

    I have a quetion. I am using VC++ where i am getting values from the GUI controls using the DoDataExchange() function.

    I have two buttons on my screen with ids IDOK and IDCANCEL, so my question is how do i make out in the DoDataExchange() function whether which button is pressed ??

    Thank you in advance.

  2. #2
    Registered User Queatrix's Avatar
    Join Date
    Apr 2005
    Posts
    1,342
    Why use DoDataExchange()?

    WM_COMMAND sent to the window when you push the button. And it's ID is in the LPARAM.

  3. #3
    Banned SniperSAS's Avatar
    Join Date
    Aug 2005
    Posts
    175
    msdn link for further information.

    so you will be setting up something like this:
    Code:
            case WM_COMMAND:
                switch(LOWORD(wParam))
                {
                    case IDOK:
                        //do some stuff
                    break;
                    case IDCANCEL:
                        //do some some other stuff
                    break;
                }
            break;
    in your window process

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how to put a check on an extern variable set as flag
    By rebelsoul in forum C Programming
    Replies: 18
    Last Post: 05-25-2009, 04:13 AM
  2. Waiting for PrintScreen to be pressed
    By lord mazdak in forum Windows Programming
    Replies: 1
    Last Post: 11-01-2005, 09:59 AM
  3. writing text over a deleted button
    By algi in forum Windows Programming
    Replies: 4
    Last Post: 05-02-2005, 12:32 PM
  4. disabling button in another prog
    By timmygax in forum Windows Programming
    Replies: 11
    Last Post: 10-29-2001, 03:40 PM
  5. Unselecting a selected button in C++Builder 5
    By Frozen_solid in forum Windows Programming
    Replies: 4
    Last Post: 09-25-2001, 08:57 PM

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