What might cause a Delphi program to 'prevent Windows shutdown'? -


one of delphi xe2 programs, when running , idle, 'prevents windows shutdown'. not case of applications , need resolve it. on xp, windows silently fails close; on win7 dialog shows application preventing shutdown.

unlike similar questions here, program single-threaded, not using tray, , have temporarily disconnected onclosequery , formclose events in main form , 1 subsidiary form had them. in normal use program closes cleanly , no trace of remains in process explorer.

i have experimemtally added wm_queryendsession , wm_endsession handlers write log message windows event log. on test windows shutdown, former fires, wparam , lparam both zero.

i grateful ideas on causing this, or how investigate further. reluctant try call halt on wm_queryendsession without knowing going on.

in final state failing, program had formclosequery methods reconnected, in each 1 checking 'shuttingdown' global boolean, , allowing close if set. shuttingdown set true in wm_queryendsession message handler on main form. works single-form applications.

the problem caused fact formclosequery handlers other main form called before wm_queryendsession message handler on main form. had missed fact in various edits , tests had been making.

if application has subsidiary form has formclosequery handler, in result might 'do not close' if called @ random moment (e.g. @ end session, when form might not have been initialized) require wm_queryendsession message handler in each such form. can set form or local variable cause formclosequery set canclose true.


Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -