Message box

Discussion in 'C++' started by Jonathan Mcdougall, Aug 2, 2003.

  1. On Sun, 3 Aug 2003 01:24:02 +0100, "Wawa"
    <> wrote:

    >Hi all,
    >
    >These are the best places I can find to ask this, I can't find a good Visual
    >C++ ng.


    This is no good place to ask this. comp.lang.c++ talks only about
    Standard C++, which has nothing to do with Windows.

    >In the 'WM_PAINT' event I call a routine to draw certain shapes. I have an
    >MB_OK message box which pops up to indicate an error, and I want to suspend
    >all action of the program (i.e. disable the event handler) until the the
    >user acknowledges the message box by clicking 'Ok' or closing it.


    <ot>

    Well you could set a flag when an error message pops up and and check
    this flag in the loop in WinMain.. that would be quite easy, no?

    </ot>

    Jonathan
    Jonathan Mcdougall, Aug 2, 2003
    #1
    1. Advertising

  2. Jonathan Mcdougall

    Wawa Guest

    Hi all,

    These are the best places I can find to ask this, I can't find a good Visual
    C++ ng.

    I've written a program in Visual C++, which is a board game, so has a fair
    amount of input from the user.

    In the 'WM_PAINT' event I call a routine to draw certain shapes. I have an
    MB_OK message box which pops up to indicate an error, and I want to suspend
    all action of the program (i.e. disable the event handler) until the the
    user acknowledges the message box by clicking 'Ok' or closing it.

    I tried using a 'do' loop with the message box successful return as the
    condition, or an endless for loop with a break, etc., however, the event
    queue still overrides the action, and the user can still click on the screen
    and it goes into the 'WM_LBUTTONDOWN' event.

    Is there a way I can fix this, short of setting a flag when the messagebox
    is acknowleged, and putting an 'if' in all my events to check if the flag?

    Thank in advance,
    Wawa
    Wawa, Aug 3, 2003
    #2
    1. Advertising

  3. Jonathan Mcdougall

    Rolf Magnus Guest

    Wawa wrote:

    > Hi all,
    >
    > These are the best places I can find to ask this, I can't find a good
    > Visual C++ ng.


    comp.lang.c++ is not the best place, since here, we only deal with the
    C++ language as defined by the ISO standard, which doesn't cover
    message boxes or anything that is system dependant.
    Rolf Magnus, Aug 3, 2003
    #3
  4. Jonathan Mcdougall

    Stephen Howe Guest

    > These are the best places I can find to ask this, I can't find a good
    Visual
    > C++ ng.


    What, not even the 22+ VC++ newsgroups on Microsoft's own news server, not
    counting even the non-English speaking VC++ newsgroups?
    Visit News Server: msnews.microsoft.com

    Stephen Howe
    Stephen Howe, Aug 3, 2003
    #4
  5. Jonathan Mcdougall

    Wawa Guest

    > This is no good place to ask this. comp.lang.c++ talks only about
    >Standard C++, which has nothing to do with Windows.


    Do loops, while loops and flags are standard C, and that was the basis of my
    post, but let's not get pedantic. There's so many newsgroups it's sometimes
    hard to find an appropriate one, and people's reaction if you don't suceed
    are never helpful.

    >
    > <ot>
    >
    > Well you could set a flag when an error message pops up and and check
    > this flag in the loop in WinMain.. that would be quite easy, no?
    >
    > </ot>
    >


    In my original post I wrote:
    "Is there a way I can fix this, short of setting a flag when the messagebox
    is acknowleged, and putting an 'if' in all my events to check if the flag?"

    so I had considered that option already.
    Wawa, Aug 3, 2003
    #5
  6. On Sun, 3 Aug 2003 03:07:47 +0100, "Wawa"
    <> wrote:

    >> This is no good place to ask this. comp.lang.c++ talks only about
    >>Standard C++, which has nothing to do with Windows.

    >
    >Do loops, while loops and flags are standard C,


    You should choose wether you are programming in C++ or C.

    >and that was the basis of my
    >post, but let's not get pedantic. There's so many newsgroups it's sometimes
    >hard to find an appropriate one, and people's reaction if you don't suceed
    >are never helpful.


    Suceeding is not that difficult. Just pick a newsgroup directly
    related to your question. If your question is about loops and flags,
    then it is welcomed here.

    >> <ot>
    >>
    >> Well you could set a flag when an error message pops up and and check
    >> this flag in the loop in WinMain.. that would be quite easy, no?
    >>
    >> </ot>
    >>

    >
    >In my original post I wrote:
    >"Is there a way I can fix this, short of setting a flag when the messagebox
    >is acknowleged, and putting an 'if' in all my events to check if the flag?"
    >
    >so I had considered that option already.


    To quote you myself :

    "[..] and putting an 'if' in all my events to check if the flag?"

    You only need to put the test in the main loop and that's it.
    Basically, you want a 'pause' feature :

    int main()
    {
    bool pause = false;

    // main loop
    while ( true )
    {
    if ( paused() ) pause = true;
    if ( unpaused() ) pause = false;

    if (pause) continue;

    // other handling
    }
    }


    If you want a solution which concerns the windows api, please do not
    post in standard c++ newsgroups.


    Jonathan
    Jonathan Mcdougall, Aug 3, 2003
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. mit
    Replies:
    1
    Views:
    805
    Ramu Pulipati
    Jan 25, 2006
  2. =?Utf-8?B?QW5nZWw=?=

    COMBO BOX INSTEAD OF DROP DOWN BOX

    =?Utf-8?B?QW5nZWw=?=, Jun 29, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    611
    Ken Cox [Microsoft MVP]
    Jun 29, 2004
  3. SirPoonga
    Replies:
    2
    Views:
    759
    Ben Strackany
    Jan 7, 2005
  4. Replies:
    1
    Views:
    1,151
    David Wier
    Aug 5, 2005
  5. Gnarlodious
    Replies:
    4
    Views:
    17,588
    elizas
    May 5, 2010
Loading...

Share This Page