$INCLUDE "RAPIDQ.INC" Declare Sub EscPress (Key AS BYTE,Sender as QForm) CREATE Form1 AS QFORM Caption = "Form1" Width = 320 Height = 240 top=10 KeyPreview=1 OnKeyPress=EscPress END CREATE CREATE Form2 AS QFORM Caption = "Form2" Width = 320 Height = 240 top=80 KeyPreview=1 OnKeyPress=EscPress END CREATE Form2.Show Form1.Show DO DoEvents '-- Process events from either form LOOP UNTIL Form1.Visible = 0 AND Form2.Visible = 0 '***************************************** Sub EscPress (Key AS BYTE,Sender as QForm) select case Sender.caption case "Form1" showmessage("Form1") Form1.close case "Form2" showmessage("Form2") Form2.close end select End Sub