请看下面这段代码:
type
TMyClass = class(TComponent)
private
hnd:HWND;
FFoldType:FolderTypes;
FTitle:string;
         ...
         public
constructor Create(AOwner:TComponent);override;
...
         end;
implementation
...constructor TMyClass.Create(AOwner:TComponent);
begin
inherited Create(AOwner);
hnd:=Application.Handle;//获得创建类的程序的实例句柄.
...
end;
//现在我想请问大家,如何才能获得创建类的父的句柄.如把该控件放到某一窗口上,
//该类的值hnd就得到那窗口的句柄.注:该控件必须要由TComponent继承.

解决方案 »

  1.   

    protected
        { Protected declarations }    
        procedure SetParent(AParent: TWinControl); override;procedure TMyClass.SetParent(AParent: TWinControl);
    var
      I: Integer;
    begin
      inherited SetParent(AParent);
      hnd := AParent.Hanle;
    end;—————————————————————————————————
    宠辱不惊,看庭前花开花落,去留无意;毁誉由人,望天上云卷云舒,聚散任风。
    —————————————————————————————————