![]() |
Re: Alt F4 sperren
Evtl. kannst du es auch über das OnCloseQuery Ereignis lösen und je nach Bedarf CanClose auf true bzw. false setzen.
|
Re: Alt F4 sperren
so danke leute habs gelöst :
1.) procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction); begin Action := caNone; end; 2.) procedure TSchulForm.Label1Click(Sender: TObject); begin SchulForm.visible:=false; MainForm.visible:=true; end; damit ist das form zwar net geschlossen aber nicht mehr sich bar und das vorigere sicht bar also ziel erreicht danke leute !!! gruss |
Re: Alt F4 sperren
Nur interessehalber:
Lässt sich das Programm so beenden? |
Re: Alt F4 sperren
Zitat:
Wieso funktioniert mein Code nicht? Was passiert / passiert nicht? Grüße Faux |
Re: Alt F4 sperren
Einfach:
Delphi-Quellcode:
Allerdings lässt es sich dann auch nicht mehr über Form1.close oder so beenden!
//...
CanClose := False; //... |
Re: Alt F4 sperren
Hi,
folgende Unit einfach ins Projekt aufnehmen:
Delphi-Quellcode:
Die Erweiterung um das ESC ist no problem...
unit KILL_AltF4;
interface Uses Classes, Windows, Forms; Var FKeyHook : HHook; implementation function KeyboardHook(code: Integer; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall; Var KeyboardState: TKeyboardState; begin GetKeyboardState(KeyboardState); if (KeyboardStateToShiftState(KeyboardState) = [ssAlt]) and (wParam = VK_F4) then Result := 1 else Result := CallNextHookEx(FKeyHook, code, wParam, lParam); end; initialization FKeyHook := SetWindowsHookEx(WH_KEYBOARD, KeyboardHook, 0, GetCurrentThreadId); finalization UnhookWindowsHookEx(FKeyHook); end. Frank |
Re: Alt F4 sperren
Wozu ein Hook? Es wurde doch schon drei mal gepostet, wie es am vernünftigsten zu lösen ist. :-?
|
Re: Alt F4 sperren
Noch ne vernünftige Methode(?)
Einfach bei Labelklick ein Flag setzen und bei dem OnClose abfragen obs gesetzt ist oder nicht und dann entsprechend handeln :-D |
Re: Alt F4 sperren
Zitat:
Grüße Faux |
Alle Zeitangaben in WEZ +1. Es ist jetzt 06:08 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