{Listing 2: An object-oriented window procedure} function Window.WindowProc( Message, Wrd: Word; Lng: Longint): Longint; var Msg: WMsg; Handler: pointer; begin Msg.WParam := Wrd; Msg.LParam := Lng; Handler := Dynamic(TypeOf(Self), Message); if Handler = Nil then WindowProc := DefMessage(Message, Msg) else begin MsgHandler(Handler)(Msg, Self); WindowProc := 0; end; end;