>>Well, my ON SHUTDOWN procedure has CLEAR EVENTS as the first line in the procedure, but it never even actually gets to my procedure. The only thing I can think of is that you can't trigger ON SHUTDOWN if you're still processing events. And since you don't know when someone might try to click on the "X" button, you can't CLEAR EVENTS before they click it. Is there a QueryUnload event for the main Visual FoxPro window? If so, I can just take care of my business there. If not, I'll just have to disable the little "X" button in the title bar (or not have an ON SHUTDOWN). :(
>
>Try:
>
>_screen.closable = .F.
Well, I actually do want _screen to be closable. Here's how I solved my problem! I have
ON SHUTDOWN DO proc.prg in my control program before READ EVENTS. proc.prg just displays a yes/no box and if yes is selected, I issue ON SHUTDOWN (with no parameters) and CLEAR EVENTS and that takes care of it all (no more weird Invalid subscript reference error). So, if the "X" is clicked or the CLOSE in the control box is chosen (both of _screen), proc.prg is executed. I have a menu item and a push button that also calls the code that ON SHUTDOWN calls. I'm not sure what I did to eliminate my problem, but I did something!
Steve.