Message box

  • Thread starter Jonathan Mcdougall
  • Start date
J

Jonathan Mcdougall

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
 
W

Wawa

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
 
R

Rolf Magnus

Wawa said:
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.
 
S

Stephen Howe

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

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
 
W

Wawa

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.
 
J

Jonathan Mcdougall

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.
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top