[comp.windows.ms] Dialog boxes and MS Windows

lau@kings.wharton.upenn.edu (Yan K. Lau) (06/01/89)

I have been working on a program using the Windows development 
kit (version 1.01) on an IBM AT using Microsoft C ver 4.0
for some time and have run into a nasty problem.  Any help 
would be greatly appreciated!

I have a timer going that displays a popup every so often
urging the user to do something.  What I want to insure
is that only one popup is displayed at a time.  For instance,
the timer will display a message, wait five minutes, display
a different message, etc.  Now if the user doesn't click on
the "okay" icon and the second popup message comes around,
the windows will be overlaid.   Eventually this will crash the
system. (when there is not more memory available?)  So I want to
remove the popup before displaying the next one.

All my dialog popup boxes are created using the MakeProcInstance,
DialogBox, and FreeProcInstance.  I have been able to remove a
popup from the screen either by sending a message to the procedure
with a case statement condition where there is an EndDialog command
or to issue the EndDialog command itself.  Then I create the new
popup and display it, etc.

The problem is that the FreeProcInstance of the original popup
is not process until the *user* selects something that causes an
EndDialog. I've observed this behavior using a debugging terminal
connected to the com port.  Then, all the FreeProcInstances of all
the popups that *I* removed are processed in reverse order with
the oldest processed last.  It seems the program goes back to next
line of code only when the user selects and not when I send the
equivalent command to the procedure.

What can I do to tell the program to process the rest of the code
before returning to the code that removed the popup (the normal
thing it does)?  This condition seems to be causing stack problems (???)
since I sometimes run into the dread FatalExit crash.


Yan.


==============================================================================
      Yan K. Lau                    + the last message of a newgroup will be:
   )~                               +   a) longer than one screen &
 ~/~  lau@scrolls.wharton.upenn.edu +   b) something you're not interested in.
 /\_                                + your decision, 'n' key or space bar?
==============================================================================