Einzelnen Beitrag anzeigen

EWeiss
(Gast)

n/a Beiträge
 
#1

TInterfacedObject Subclass

  Alt 11. Mär 2011, 05:25
Seit ich meine Listbox auf Interface umgestellt habe kann ich die Listbox nicht mehr subclassen.

Gibt es eine andere möglichkeit TObject auf ein Interface umzulegen?

Neu..
Delphi-Quellcode:
  ISkinListBox = interface
    ['{38EF3B4F-86A1-45D0-A7F3-4E45E125979D}']
    function GetHandle: hWnd;
    property Handle: hWnd read GetHandle;
    procedure SetFont(nPointSize: Integer; FontName: PAnsiChar; AktForecolor: COLORREF;
      InAktForecolor: COLORREF; Shadow: Boolean; SOffset: Integer; ShadowColor: COLORREF);
  end;

  TSkinListBox = class(TInterfacedObject, ISkinListBox)
vorher..
TSkinListBox = class(TObject)
Delphi-Quellcode:
procedure TSkinListBox.SubClass(WinHandle: HWND);
var
  Method: TMethod;
begin
  Method.Code := @TSkinListBox.ListBoxProc;
  Method.Data := Self;
  FEnumProcInst := MakeProcInstance(Method);

  PrevWndProc := SetWindowLong(WinHandle, GWL_WNDPROC, integer(@WndProc));
  PrevWndProcLB := SetWindowLong(Handle, GWL_WNDPROC, integer(FEnumProcInst));

end;

Vorher einwandfrei Funktioniert.



gruss
  Mit Zitat antworten Zitat