![]() |
Anti End Task, not WM_Close?
To prevent WM_Close, I use
Code:
Try to click End Task with TaskManager, after several seconds, there will be an end task dialog then the app can be killed. How to prevent this? I just want to prevent End Task.
procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin CanClose := false end; |
AW: Anti End Task, not WM_Close?
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. |
AW: Anti End Task, not WM_Close?
Zitat:
edited :
Code:
The code is right?
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; |
AW: Anti End Task, not WM_Close?
Zitat:
Delphi-Quellcode:
Bernhard
if (GetSystemMetrics (SM_SHUTTINGDOWN) <> 0) then
CanClose := true; |
AW: Anti End Task, not WM_Close?
Zitat:
|
AW: Anti End Task, not WM_Close?
And what's the use of it? If I want to end your application I just will call ProcessTerminate and that's it. Even a normal user cab do this. He just has to switch to the process panel of the taskmanager. Users ain't silly.
|
AW: Anti End Task, not WM_Close?
Zitat:
|
AW: Anti End Task, not WM_Close?
Why hook ProcessTerminate? - You just need to hook OpenProcess.
But why do you do so? - Just create a process with Admin-Account and don't let the user get Admin-Rights and your process acts like it should, cause a Non-Admin can't terminate Processes from an Admin-Account. Or create a service. Bernhard |
AW: Anti End Task, not WM_Close?
Zitat:
|
AW: Anti End Task, not WM_Close?
Why do you need a not-closable Application?
Bernhard |
Alle Zeitangaben in WEZ +1. Es ist jetzt 08:20 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz