Thread: help making a message box popup

  1. #1
    Registered User
    Join Date
    Mar 2004
    Posts
    44

    help making a message box popup

    i am learning c++ and am working on an application that popups a messagebox when somebody presses ok or cancel
    Code:
    MessageBox(NULL,"God you idiot i told you not to open it","You idiot",MB_OKCANCEL);
    do i need to add a
    Code:
    function::OnOK();
    function::OnCANCEL();
    because i think that is how the API does it?

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

    Lightbulb I believe you need this ...

    Okay. It's been a while since I've posted here. I have been really busy in high school, and I have a project I'm working on. I'm working on a 2D engine, using SDL, for a game my friends and I are going to make.

    Anyhow, here's what I believe you need:

    Code:
    int nRet = MessageBox(NULL, "Message", "Title", MB_OKCANCEL);
    
    if (nRet == MB_OK) 
    {
        // Process "Ok" button
        // ...
    }
    else if (nRet == MB_CANCEL) 
    {
        // Process "Cancel" button
        // ...
    }
    If you're wanting to know what the user chooses, that's they answer.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Creating an Edit Box (Subclassing)
    By csonx_p in forum Windows Programming
    Replies: 9
    Last Post: 05-05-2008, 06:36 AM
  2. Making a script language?
    By Blackroot in forum Game Programming
    Replies: 10
    Last Post: 02-16-2006, 02:22 AM
  3. Message box / Structure question?
    By dxfoo in forum Windows Programming
    Replies: 5
    Last Post: 10-24-2005, 01:43 PM
  4. edit box affecting displaying of text?
    By algi in forum Windows Programming
    Replies: 4
    Last Post: 05-04-2005, 03:28 PM
  5. moving a dialog box and making a button a bitmap
    By Unregistered in forum Windows Programming
    Replies: 5
    Last Post: 05-22-2002, 04:38 AM