I encountered a similar problem today. In my application, there are two pop-up forms," PopFormB" overlays PopFormA. Each pop-up form has a "Done" button, which causes information to be saved in the database before returning to the underlying form. Because the application can easily exit before any "Done" button is tapped, I had added code to my AppStop() routine to simulate tapping the "Done" button of an open pop-up form:
If the PopFormB was found to be open, I used EvtAddEventToQueue(&ev1); to post a CtlSelectEvent for its "Done" button, then used EvtGetEvent(&evt,evtWaitForever); to retrieve the event. After normal dispatching of that event, I immediately used EvtAddEventToQueue(&ev1); again, to post a second CtlSelectEvent for the "Done" button of PopFormA; and repeated EvtGetEvent(&evt,evtWaitForever); to get that event for dispatching. In testing (exiting the application before tapping the "Done" button on PopFormB), I found that the first event was processed as expected, as if PopFormB's "Done" button had been tapped. But the second event was not processed at all. Debugging showed that the data fields in the control structures for the second event contained 0 for the controlID instead of the ID of PopFormA's "Done" button. As an experiment, I changed the "timeout" parameter in both of the EvtGetEvent() calls from "evtWaitForever" to 50. That solved the problem. I hope this information is helpful to you and others. Dr. S.L. Sanders 2007may02(21:25)-sls -- For information on using the ACCESS Developer Forums, or to unsubscribe, please see http://www.access-company.com/developers/forums/
