Thema: Delphi direktive "message"

Einzelnen Beitrag anzeigen

Benutzerbild von Neutral General
Neutral General

Registriert seit: 16. Jan 2004
Ort: Bendorf
5.219 Beiträge
 
Delphi 10.2 Tokyo Professional
 
#12

AW: direktive "message"

  Alt 22. Mär 2011, 09:01
Hallo,

Wenn es nur um 1 einzelnes Richedit oder so geht, dann ginge auch folgendes:

Delphi-Quellcode:
TForm1 = class(TForm)
  Richedit1: TRichedit;
private
  FOldWndProc: TWndMethod;
  procedure NewWndProc(var Msg: TMessage);
public
  { Public-Deklarationen }
end;


procedure TForm1.FormCreate(Sender: TObject);
begin
  FOldWndProc := Richedit1.WndProc;
  Richedit1.WndProc := NewWndProc;
end;

procedure TForm1.NewWndProc(var Msg: TMessage);
begin
  FOldWndProc(Msg); // => "inherited"
  if Msg.Msg = WM_SETFOCUS then
    ShowMessage('SetFocus!');
end;
(Habs jetzt ausm Kopf getippt. Hoffe mal dass ich keine Fehler drin hab)

Gruß
Neutral General
Michael
"Programmers talk about software development on weekends, vacations, and over meals not because they lack imagination,
but because their imagination reveals worlds that others cannot see."
  Mit Zitat antworten Zitat