Thread: How to find out what the user pressed in MessageBox?

  1. #1
    Registered User
    Join Date
    Jan 2002
    Location
    Vancouver
    Posts
    2,212

    How to find out what the user pressed in MessageBox?

    Wierd, how do I found out whether the user pressed okay or cancel?

    this doesn't work, because it doesn't seem to return ****.

    Code:
    int a = MessageBox(NULL,"Press ok or cancel","Mmmm",1);

  2. #2
    S­énior Member
    Join Date
    Jan 2002
    Posts
    982
    Try

    if(a==IDOK)
    MessageBox(NULL,"OK","OK",0);

    afterwards.

  3. #3
    Registered User WayTooHigh's Avatar
    Join Date
    Aug 2001
    Posts
    101
    here are the values MessageBox() can return:

    0 - Message Box could not be created.
    IDABORT - Abort button was selected.
    IDCANCEL - Cancel button was selected.
    IDIGNORE - Ignore button was selected.
    IDNO - No button was selected.
    IDOK - OK button was selected.
    IDRETRY - Retry button was selected.
    IDYES - Yes button was selected
    Sometimes, the farthest point from the center is the center itself.

    Your life is your canvas, it's only as beautiful as you paint it.

  4. #4
    Registered User
    Join Date
    Jan 2002
    Location
    Vancouver
    Posts
    2,212
    oh, okay thanks. Maybe this should go on the FAQ board?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to limit user input to a certain number of digits?
    By NewbGuy in forum C Programming
    Replies: 7
    Last Post: 05-08-2009, 09:57 PM
  2. timed user input
    By sainiabhishek in forum C Programming
    Replies: 4
    Last Post: 04-01-2009, 11:59 AM
  3. Newbie Help: Currency Converter
    By Ashfury in forum C Programming
    Replies: 10
    Last Post: 11-06-2005, 01:21 PM
  4. EnterCriticalSection and MessageBox
    By novacain in forum Windows Programming
    Replies: 13
    Last Post: 01-30-2003, 08:48 AM