As Boris said, QueryUnload is only called when you try to close the form with the X at the top. May be instead you want to try to bind RELEASE method of the form ?
>somebody provided me following codes, but those do not work
>
>Pleaes modify
>
>
>Maybe bindevent can help you.
>The idea is to write your own handler for queryunload and bind to your forms.
>
>*
>* in your main.prg add handler to each form
>*
>for each m.form in _screen.forms
> do myHandler with m.form
>endfor
>
>
>*
>* myHandler.prg
>*
>para oForm
>private o
>m.o=createobject("myHandler")
>=addproperty(m.oForm,"__handler", m.o)
>=bindevent(m.oForm,"queryunload",m.o,"doQueryUnload")
>
>define class myHandler as session
> datasession=1
>
> function doQueryUnload
> =messagebox("Please press close button to exit",_screen.ActiveForm.caption)
> nodefault
>enddefine
If it's not broken, fix it until it is.
My Blog