AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Anti End Task, not WM_Close?

Ein Thema von user · begonnen am 1. Jan 2011 · letzter Beitrag vom 3. Jan 2011
Antwort Antwort
Seite 1 von 3  1 23      
user

Registriert seit: 13. Jul 2010
25 Beiträge
 
Delphi 2 Desktop
 
#1

Anti End Task, not WM_Close?

  Alt 1. Jan 2011, 19:56
To prevent WM_Close, I use

Code:
procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
CanClose := false
end;
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.
  Mit Zitat antworten Zitat
Dezipaitor

Registriert seit: 14. Apr 2003
Ort: Stuttgart
1.701 Beiträge
 
Delphi 7 Professional
 
#2

AW: Anti End Task, not WM_Close?

  Alt 1. Jan 2011, 20:04
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.
Christian
Windows, Tokens, Access Control List, Dateisicherheit, Desktop, Vista Elevation?
Goto: JEDI API LIB & Windows Security Code Library (JWSCL)
  Mit Zitat antworten Zitat
user

Registriert seit: 13. Jul 2010
25 Beiträge
 
Delphi 2 Desktop
 
#3

AW: Anti End Task, not WM_Close?

  Alt 1. Jan 2011, 20:07
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?

Geändert von user ( 1. Jan 2011 um 20:25 Uhr)
  Mit Zitat antworten Zitat
Benutzerbild von rollstuhlfahrer
rollstuhlfahrer

Registriert seit: 1. Aug 2007
Ort: Ludwigshafen am Rhein
1.529 Beiträge
 
Delphi 7 Professional
 
#4

AW: Anti End Task, not WM_Close?

  Alt 1. Jan 2011, 20:34
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?
Can't be right. You don't set CanClose to true in any case. It has to be
Delphi-Quellcode:
if (GetSystemMetrics (SM_SHUTTINGDOWN) <> 0) then
CanClose := true;
Bernhard
Bernhard
Iliacos intra muros peccatur et extra!
  Mit Zitat antworten Zitat
user

Registriert seit: 13. Jul 2010
25 Beiträge
 
Delphi 2 Desktop
 
#5

AW: Anti End Task, not WM_Close?

  Alt 1. Jan 2011, 20:43

Can't be right. You don't set CanClose to true in any case. It has to be
Delphi-Quellcode:
if (GetSystemMetrics (SM_SHUTTINGDOWN) <> 0) then
CanClose := true;
Bernhard
Still not working. I also change the value of SM_SHUTTINGDOWN to 2000 (referenced from MSDN). I am using 7 32 bit.
  Mit Zitat antworten Zitat
Benutzerbild von Luckie
Luckie

Registriert seit: 29. Mai 2002
37.621 Beiträge
 
Delphi 2006 Professional
 
#6

AW: Anti End Task, not WM_Close?

  Alt 1. Jan 2011, 20:43
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.
Michael
Ein Teil meines Codes würde euch verunsichern.
  Mit Zitat antworten Zitat
user

Registriert seit: 13. Jul 2010
25 Beiträge
 
Delphi 2 Desktop
 
#7

AW: Anti End Task, not WM_Close?

  Alt 1. Jan 2011, 20:45
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.
I already hook TerminateProcess.
  Mit Zitat antworten Zitat
Benutzerbild von rollstuhlfahrer
rollstuhlfahrer

Registriert seit: 1. Aug 2007
Ort: Ludwigshafen am Rhein
1.529 Beiträge
 
Delphi 7 Professional
 
#8

AW: Anti End Task, not WM_Close?

  Alt 1. Jan 2011, 20:49
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
Bernhard
Iliacos intra muros peccatur et extra!
  Mit Zitat antworten Zitat
user

Registriert seit: 13. Jul 2010
25 Beiträge
 
Delphi 2 Desktop
 
#9

AW: Anti End Task, not WM_Close?

  Alt 1. Jan 2011, 21:03
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
Yes, hooking XxOpenProcess maybe better than hooking XxProcessTerminate. I'll implement that later. No, user can use my app in Admin-Account. My problem is user can kill my app from end task.
  Mit Zitat antworten Zitat
Benutzerbild von rollstuhlfahrer
rollstuhlfahrer

Registriert seit: 1. Aug 2007
Ort: Ludwigshafen am Rhein
1.529 Beiträge
 
Delphi 7 Professional
 
#10

AW: Anti End Task, not WM_Close?

  Alt 1. Jan 2011, 21:08
Why do you need a not-closable Application?

Bernhard
Bernhard
Iliacos intra muros peccatur et extra!
  Mit Zitat antworten Zitat
Antwort Antwort
Seite 1 von 3  1 23      


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 06:57 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz