Autor Beitrag
DelphiNoob
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 152

Win 2003 Server
D7 Ent
BeitragVerfasst: Mi 22.01.03 21:39 
Hi,

da man unter einem NT System (NT, 2k, XP) ja bekanntlich nicht "einfach" so die Systemtasten deaktivieren kann, wie z.b. bei 9x Systeme hab ich mir etwas gebastelt um die ALT + F4 Vorrichtung zu überlisten.

Wenn man mein Programm wie vorgesehen über den Beenden knopf schliesst (der PC fährt dann runter), funktioniert auch alles. abei wird eine Variable übergeben die Boolean ist. In der Procedure FormClose steht also: If Beenden = true then... usw.

Nun ist es so, das wenn ELSE zutrifft, also beenden nicht true ist, ich gerne das Beenden des Programmes abbrechen würde. Soll heissen es soll bestehen bleiben. Auf diese Art und Weise hätte ALT + F4 keine Chance.

Falls es jemanden interessiert wieso dies so Wichtig ist: Das Programm wird im Endeffekt ein Klassenraum-Kontroll-Programm für weiterführende Schulen.

Ich hoffe auf eine schnelle Antwort.

Mfg

DelphiNoob
littlemike1005
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 187



BeitragVerfasst: Mi 22.01.03 21:48 
solange der anwender die möglichkeit hat einen task per taskmanager "abzuschiessen" kann man dein prog auch beenden.

ich glaube nicht das es ausreicht wenn du nur das beenden verhinderst.
DelphiNoob Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 152

Win 2003 Server
D7 Ent
BeitragVerfasst: Mi 22.01.03 21:51 
Doch...

wenn ich den Prozess über den TaskMgr killen will, kommt auch die If beenden True abfrage. Ich bräuchte eine Möglichkeit an diesem Punkt das beenden zu stoppen.

Ok, es mag sein das durch den TaskMgr das Programm dann dennoch Beendet wird, aber es dürfte ja nicht so schwer sein den Handle von TaskMgr zu kriegen, und den bei Öffnung beenden.
DelphiNoob Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 152

Win 2003 Server
D7 Ent
BeitragVerfasst: Mi 22.01.03 21:54 
Und falls jemand doch weiß wie man vieleicht die Systemtasten deaktivieren kann (2k/XP), der soll sich melden! Ich würde auch abgeänderte .dll's in kauf nehmen.
littlemike1005
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 187



BeitragVerfasst: Mi 22.01.03 22:22 
@DelphiNoob du bist ja ein killer. ne fenster wech du bist über. und tschüsssss.

ja ne windows is klar
DelphiNoob Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 152

Win 2003 Server
D7 Ent
BeitragVerfasst: Mi 22.01.03 22:25 
Schon mal Taskmgr offen gehabt und ALT + F4 gedrückt. Der schliesst ganz normal! Das kann man ohne weiteres simulieren...
smiegel
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 992
Erhaltene Danke: 1

WIN 7
D7 Prof., C#, RAD XE Prof.
BeitragVerfasst: Mi 22.01.03 22:49 
Hallo,
ausblenden Delphi-Quelltext
1:
2:
3:
4:
TForm1.FormClose(Sender: TObject; var Action:TCloseAction);
begin
  if Beenden then Action:=caFree else Action:=caNone;
end;

_________________
Gruß Smiegel
Ich weiß, daß ich nichts weiß, aber ich weiß mehr als die, die nicht wissen, daß sie nichts wissen. (Sokrates)
DelphiNoob Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 152

Win 2003 Server
D7 Ent
BeitragVerfasst: Mi 22.01.03 23:36 
Danke smiegel für diese produktive Antwort. Hat mir sehr geholfen!
Wolff68
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 302
Erhaltene Danke: 1

WinXP home
D6 Prof
BeitragVerfasst: So 26.01.03 00:05 
Warum setzt Du nicht einfach im Form.OnCloseQuery das CanClose auf false?
Dann schließt sich Dein Programm doch auch nicht !?

_________________
"Der Mensch ist nicht was er sich vorstellt oder wünscht zu sein, sondern das was andere in ihm sehen."