On Fri, 05 Mar 2010, Saulius Zrelskis wrote: Hi,
> [for those interested] > Sample below really controls console close button on Windows XP and > later systems. Please test it and enjoy:) Yes it is and we have exactly such code in our GTWIN (unfortunately it needs GetConsoleWindow() so it does not work with older Windows versions) and it can be enabled by: hb_gtInfo( HB_GTI_CLOSABLE, .F. ) Viktor added it few days ago with additional code which safe and restore original settings so Harbour applications does not change [X] button state for other applications executing in the same console. The problem is that you send message wrongly informing that it's possible to catch CTRL_CLOSE_EVENT and block it when in fact it's not possible. If application ignores above event then after few seconds OS displays message box asking user to terminate the application. This OS behavior can be controlled in very limited way and only on very few windows versions so it's not sth what we should ever try to use. BTW I would like to note that this event handler is executed by separate non HVM thread. It means that it's illegal to call any HVM functions like hb_set[SG]etCancel() from this handler, best regards, Przemek _______________________________________________ Harbour mailing list (attachment size limit: 40KB) Harbour@harbour-project.org http://lists.harbour-project.org/mailman/listinfo/harbour