Call getsystemmetrics with SM_SHUTTINGDOWN and set CanClose to true in such a case.
BTW: Your app is not user friendly. However, in the end the user will always be able to close your application. It just takes a little more effort.
I'll try "getsystemmetrics with SM_SHUTTINGDOWN". Yeah I just want to prevent end task. I know there are many ways to kill an app. No I'm not making virus!
edited :
Code:
SM_BASE = WM_USER + 1736 ;
SM_SHUTTINGDOWN = SM_BASE +2;
procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
CanClose:=false;
if (GetSystemMetrics (SM_SHUTTINGDOWN) <> 0) then
CanClose:=false;
end;
The code is right?