Button Identifier Problems!

This is a discussion on Button Identifier Problems! within the Windows Programming forums, part of the Platform Specific Boards category; I have a button: HWND done; done = CreateWindow( "BUTTON", "Save", WS_CHILD | WS_VISIBLE, 0, 175, 160, 100, hwnd, (HMENU)ID_BUTTON, ...

  1. #1
    Programming is fun, mkay?
    Join Date
    Oct 2001
    Posts
    490

    Question Button Identifier Problems!

    I have a button:

    HWND done;

    done = CreateWindow(
    "BUTTON",
    "Save",
    WS_CHILD | WS_VISIBLE,
    0, 175,
    160, 100,
    hwnd,
    (HMENU)ID_BUTTON,
    hInst,
    NULL
    );

    When I do:

    case WM_COMMAND:
    if(hwnd, WM_COMMAND, (HMENU)ID_BUTTON, BN_CLICKED, 0, done)

    to check if a button the button was clicked, it pops up the message box when I click the button but also when I click on an edit box. What do I do?
    Website(s): http://www16.brinkster.com/trifaze/

    E-mail: trifaze_mattu@lycos.com

    ---------------------------------
    C++ Environment: MSVC++ 6.0; Dev-C++ 4.0/4.1
    DirectX Version: 9.0b
    DX SDK: DirectX 8.1 SDK

  2. #2
    Just one more wrong move. -KEN-'s Avatar
    Join Date
    Aug 2001
    Posts
    3,230
    I don't get your if statement...

    but your problem is that it's always going to be true, and a WM_COMMAND gets sent when you click an edit box, so since your if is always true that portion of code will always be executed when it gets WM_COMMAND

    try this...

    case WM_COMMAND:
    switch(LOWORD(wParam))
    {
    case ID_BUTTON:
    /*do whatever*/
    break;
    default:
    break;
    }
    return 0;

  3. #3
    Programming is fun, mkay?
    Join Date
    Oct 2001
    Posts
    490

    Thank you

    Thank you. That worked!
    Website(s): http://www16.brinkster.com/trifaze/

    E-mail: trifaze_mattu@lycos.com

    ---------------------------------
    C++ Environment: MSVC++ 6.0; Dev-C++ 4.0/4.1
    DirectX Version: 9.0b
    DX SDK: DirectX 8.1 SDK

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Newbee Q: reg. MFC dlg button & Vista UAC shield icon
    By colbyringeisen in forum Windows Programming
    Replies: 3
    Last Post: 12-29-2008, 04:16 PM
  2. Problems with formatting text.
    By vrek in forum Windows Programming
    Replies: 1
    Last Post: 04-10-2007, 11:44 PM
  3. Learning OpenGL
    By HQSneaker in forum C++ Programming
    Replies: 7
    Last Post: 08-06-2004, 08:57 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. error: identifier "byte" is undefined.
    By Hulag in forum C++ Programming
    Replies: 4
    Last Post: 12-10-2003, 04:46 PM

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