Viktor,

It also doesn't work on Vista/Win7/2008.

Maybe is about CTRL_LOGOFF_EVENT, CTRL_SHUTDOWN_EVENT that is received only by 
services.
But if so is a issue of Vista and Win7/2008, not ours, because the official 
documentation nothing says about this, AFAIK.
And no excuse for not correcting the current Harbour behavior, IMHO.
Also in .NET (please see example Visual C++ and Platforms) .-

http://msdn.microsoft.com/en-us/library/system.gc.keepalive%28VS.100%29.aspx

I tested it on XP x64, there there is a window
asking for 'Cancel' and 'End Now', so even here
this method cannot prevent the app to be closed
by user. In any case it's not a SETCANCEL() thing,

Just as DOS Clipper's programs.

but maybe rather it could be the standard GTWIN
behavior (without any extra setting). For sure
it's not a HB_GTI_CLOSABLE setting either. Or,
we just leave it as is.

IMHO are two different targets, things, HB_GTI_CLOSABLE / SETCANCEL.
HB_GTI_CLOSABLE aims to modify the user interface (if possible).
SETCANCEL aims to avoid interruption of the code execution by the user (if 
possible).
BTW in te case of GTWVT, I don't think that changing the status of SETCANCEL in response to WM_CLOSE meet the objective of SETCANCEL.

--
Xavi

El 04/03/2010 20:38, Viktor Szakáts escribió:
It also doesn't work on Vista/Win7/2008.

Did _you_ read the comments in your quoted (now
for the 6th times) article?

I tested it on XP x64, there there is a window
asking for 'Cancel' and 'End Now', so even here
this method cannot prevent the app to be closed
by user. In any case it's not a SETCANCEL() thing,
but maybe rather it could be the standard GTWIN
behavior (without any extra setting). For sure
it's not a HB_GTI_CLOSABLE setting either. Or,
we just leave it as is.

Brgds,
Viktor

On 2010 Mar 4, at 20:21, Xavi wrote:

Sorry I meant SetCancel(.F.)

http://msdn.microsoft.com/en-us/library/ms683242%28VS.85%29.aspx

"
An application-defined function used with the SetConsoleCtrlHandler function. A 
console process uses this function to handle control signals received by the 
process. When the signal is received, the system creates a new thread in the 
process to execute the function.
"

PROCEDURE Main()

   SetCancel(.F.)
   ? "Click [X] Not close windows"
   Wait
   RETURN

Now it's happening that you are introduced ch = HB_BREAK_FLAG in Inkey Poll, 
keyboard buffer.
Wait ends and the main process is finished so the new thread to execute the 
function is killed before it can complete their work.

--
Xavi
_______________________________________________
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to