Autor Beitrag
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Fr 12.09.03 09:58 
Hallo Leute,

ich habe ein Fenster zur Laufzeit erstellt. In der Titelleiste ist nur der Close-Button sichtbar. Jetzt möchte ich verhindern das der User diesen Button anklicken kann. Es wäre natürlich möglich den Button auszublenden... allerdings ist das in meinem Projekt wichtig, das der Button sichtbar ist... nur nicht anklickbar.

Weiß jemand wie das geht?

Danke und Gruß
Tino
cbs
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 207
Erhaltene Danke: 1



BeitragVerfasst: Fr 12.09.03 10:02 
huhu

jo (quelle: swissdelphicenter.ch)

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
procedure TForm1.FormCreate(Sender: TObject); 
begin 
  EnableMenuItem(GetSystemMenu(Form1.Handle, LongBool(False)), 
    SC_CLOSE, MF_BYCOMMAND or MF_GRAYED); 
end; 

{ 
  Note: You can still press Alt-F4 to close the form! 
  Achtung: Die Form kann immer noch mit Alt-F4 geschlossen werden! 
}
Tino Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Fr 12.09.03 10:07 
Ich hab es erstmal so gelöst:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
procedure tDocumentDialogDesignForm.WndProc(var Message: TMessage);
begin
  case Message.Msg of
      WM_CLOSE:
        Message.Result := 0;
      Else
        Inherited;
    End;
End;

Mir wäre es aber lieb wenn der User gar nicht die Möglichkeit hätte den Button zu drücken.

Gruß
Tino
Tino Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Fr 12.09.03 10:54 
@CBS: Danke... hat geklappt! :-D

Gruß
Tino