Determine MessageBox

This is a discussion on Determine MessageBox within the Windows Programming forums, part of the Platform Specific Boards category; Code: MessageBox("Delete all?", "Warning", MB_ICONWARNING | MB_DEFBUTTON2 | MB_OKCANCEL); I would like to know the best way to determine what ...

  1. #1
    Registered User
    Join Date
    May 2003
    Posts
    26

    Determine MessageBox

    Code:
    MessageBox("Delete all?", "Warning",
    MB_ICONWARNING | MB_DEFBUTTON2 | MB_OKCANCEL);

    I would like to know the best way to determine what button was pushed. Then execute code based on the outcome. After searching, I found the return value IDOK and IDCANCEL for the above prompt. Any ideas on how to implement? Thanks

    James

  2. #2
    Registered User KurtSurge's Avatar
    Join Date
    Aug 2003
    Posts
    25
    int Return = MessageBox("Delete all?", "Warning", MB_ICONWARNING | MB_DEFBUTTON2 | MB_OKCANCEL);

    Code:
    if(Return == IDOK)  {
    //execute code
    }
    else  {
    //execute code
    }
    It's too bad that stupidity isn't painful
    --Anton Szandor LaVey

  3. #3
    Registered User
    Join Date
    May 2003
    Posts
    26
    KurtSurge, Thankyou much!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Delete files that are used
    By Yuri in forum C++ Programming
    Replies: 8
    Last Post: 10-18-2005, 01:48 PM
  2. problem with A simple modeless messagebox
    By hanhao in forum C++ Programming
    Replies: 8
    Last Post: 07-05-2005, 11:18 PM
  3. Replies: 1
    Last Post: 05-15-2004, 12:58 PM
  4. EnterCriticalSection and MessageBox
    By novacain in forum Windows Programming
    Replies: 13
    Last Post: 01-30-2003, 07:48 AM
  5. A multiline MessageBox?
    By Unregistered in forum C++ Programming
    Replies: 5
    Last Post: 06-27-2002, 05:41 PM

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