Re: detecting if a modal dialog is being displayed
There is really noway to tell. What you can do is broadcast a message to
either check to see if there is one open or to tell it to close itself.
I have this class that works great for something like that.
http://www.codeproject.com/docview/Broadcaster.asp
If you want to check to see if any are open you can do something like this
1. Define WM_AREYOUOPEN message
2. Make sure that you register the message WM_AREYOUOPEN in all your modal
dialog boxes
CBroadcaster::Register(this,WM_AREYOUOPEN);
3. handle the message in your dialog boxes and return 1;
4. Unregister the message in the destructor of the dialog boxes
5. Here is how to check to see if they are open
BOOL IsOpen = FALSE;
LRESULT Result
CBoardcaster::StartSend(WM_AREYOUOPEN,0,0,Result);
while (CBroadcaster::SendNext(Result))
{
if (Result == 0)
{
IsOpen = TRUE;
break;
}
}
if (IsOpen == TRUE)
{
MessageBox("One dialog box is open");
}
if You want to just close any open modal dialog boxes follow steps 1 through
4 and for five do this
CBroadcaster::SendToAll(WM_CLOSEMODALDIALOG);
AliR.
"bhu Boue vidya" <bhuvidya@yahoo.com.au> wrote in message
news:1155650429.301622.73260@b28g2000cwb.googlegroups.com...
hi there
this may seem like a simple qst, but i have forgotten how to do it!
my app is being given data 'in the background' (from the TWAIN driver),
and to process it i need to display a modal dialog box to the user, but
i don;t want to do this if the user in the meantime has opened a modal
dialog box somewhere in my system
is there a simple way to determine if a modal dialog box is currently
being displayed in my app?
cheers
bhu