DEFINE CLASS MyAuto AS CUSTOM OLEPUBLIC FirstName = "Russell" PROCEDURE MyForm oForm = CREATEOBJECT("testform") oForm.Caption = "My Automation Server" oForm.Visible = .T. *!* >> Start event processing << READ EVENTS RETURN "Form " + oForm.Caption && This works. ie form is still active. ENDPROC ENDDEFINE define Class testform as Form ShowWindow = 2 add object cmdClose AS commandbutton WITH ; Top = 213, ; Left = 283, ; Height = 27, ; Width = 84, ; FontName = "Tahoma", ; FontSize = 8, ; Caption = "\<Close", ; Name = "cmdClose" procedure cmdClose.Click *!* *!* StartMode->2 = VFP started as an out-of-process EXE *!* automation server. *!* wait window _VFP.StartMode CLEAR EVENTS endproc enddefine