>Lparameters toForm >Thisform.oForm = m.toForm >BindEvent(toForm,"QueryUnload",This,"OnClosing") >BindEvent(toForm,"Release",This,"OnClosing") >>And this is the OnClosing method in FormB:
>UnBindEvent(This.oForm,"QueryUnload",This,"OnClosing") >UnBindEvent(This.oForm,"Release",This,"OnClosing") >Thisform.Release >>What you can't really capture easily is whether the form actually closed. QueryUnload and Release both could cancel the release process. The FoxTabs project has some code that detects which forms have been closed. I think this uses BINDEVENTS() on the windows message level to capture messages like WM_CLOSE, etc. But it wasn't easy, if I recall correctly.
>Lparameters toForm >toForm.NewObject(Sys(2015),"Proxy","Proxy.prg","",Thisform.HWnd) >>And here the code for the proxy class:
>Define Class Proxy as Custom > nHwnd = 0 > Procedure Init(tnHwnd) > This.nHwnd = m.tnHwnd > Procedure Destroy > Declare Long SendMessage in Win32Api Long, Long, Long, Long > SendMessage(This.nHwnd,16,0,0) >EndDefine >