Autor Beitrag
teamrocket0
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 177
Erhaltene Danke: 1

Win ME, Win XP, Win 7, Win 10
Delphi 7, 10.2 Tokyo
BeitragVerfasst: Di 05.09.06 15:43 
Hallo.

Ich will eine Mausefalle basteln.
Dabei kann der Mauszeiger nicht vom Formular gezogen werden und der Schlißenbutton taucht erst nach einiger Zeit auf.
Jetzt will ich noch die Möglichkeit ausschlißen das Programm vorzeitig zu beenden.
Weiß jemand wie ich die Tastenkombination ALT und F4 blocken kann?
Miri
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 657


Delphi 3 Prof., Delphi 2005 PE
BeitragVerfasst: Di 05.09.06 15:45 
über Suche in der Entwickler-Ecke FORMKEYDOWN oder Suche in der Entwickler-Ecke FORMKEYPRESS (weiß selbst nie, welches wann ;-) ) abfangen und auf #0 setzen
Marc.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1876
Erhaltene Danke: 129

Win 8.1, Xubuntu 15.10

BeitragVerfasst: Di 05.09.06 16:04 
zudem könntest du mit
"CanClose := False;" im OnCloseQuery-Ereignis das schließen verhindern. ;)
teamrocket0 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 177
Erhaltene Danke: 1

Win ME, Win XP, Win 7, Win 10
Delphi 7, 10.2 Tokyo
BeitragVerfasst: Di 05.09.06 16:10 
CanClose := False;
funktioniert leider nicht!
Marc.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1876
Erhaltene Danke: 129

Win 8.1, Xubuntu 15.10

BeitragVerfasst: Di 05.09.06 16:12 
inwiefern funktioniert es nicht? kommt eine fehlermeldung? oder kannst du des dennoch schließen?
bei mir funktioniert alles einwandfrei, selbst mit alt + f4 lässt es sich nun nicht mehr schließen :)
teamrocket0 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 177
Erhaltene Danke: 1

Win ME, Win XP, Win 7, Win 10
Delphi 7, 10.2 Tokyo
BeitragVerfasst: Di 05.09.06 16:20 
Also ich habe das:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
CanClose := False;
end;




in meinem Formular stehen.
Und das tritt beim starten auf:

[Fehler] Unit1.pas(89): Undefinierter Bezeichner: 'CanClose'

Moderiert von user profile iconChristian S.: Delphi-Tags hinzugefügt
Marc.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1876
Erhaltene Danke: 129

Win 8.1, Xubuntu 15.10

BeitragVerfasst: Di 05.09.06 16:21 
Wer lesen kann ist klar im vorteil :lol:
user profile iconMarc. hat folgendes geschrieben:
zudem könntest du mit
"CanClose := False;" im OnCloseQuery-Ereignis das schließen verhindern. ;)


Im OI eins unter OnClose ^^
Marc
teamrocket0 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 177
Erhaltene Danke: 1

Win ME, Win XP, Win 7, Win 10
Delphi 7, 10.2 Tokyo
BeitragVerfasst: Di 05.09.06 16:25 
Hm? *such such* Ah :idea: ....Danke. Das geht.
Aber mein Schlißen-Button funtz nicht.
Marc.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1876
Erhaltene Danke: 129

Win 8.1, Xubuntu 15.10

BeitragVerfasst: Di 05.09.06 16:30 
Dann würde ich, mit dem erscheinen deines Schließen Button, eine globale Variable, des Typs Boolean, für das jetztig "False" auf True setzen.
Also:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
var
 Form1: TForm1;
 vcc: Boolean;

implentation

procedure TForm1.FormCreate(Sender: TObject);
begin
 vcc := false;
end;

procedure ButtonErscheint;
begin
 vcc := true;
end;

procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
 canclose := vcc;
end;

So in der Art,
Marc