同上

解决方案 »

  1.   

    函数:
    function fun1(obj:tobject):integer;
    begin
      if obj is tlabel then  tlabel(obj).caption:='aaa';
      if obj is tedit then  tedit(obj).text:='aaa';
    end;调用:
    fun1(label1);
    fun1(edit1);
      

  2.   

    procedure yuan(obj:tobject);
    begin
      if (ojt is Tlabel) then  
        (ojt as Tlabel).caption:='这个是标签';
      if (ojt is Tedit) then  
        (ojt as Tedit)...............
    end;
      

  3.   

    我是说能用句柄(THandle)作参数。
      

  4.   

    函数:
    function fun1(h:thandle):integer;
    var
      WinControl: TWinControl;
    begin
      WinControl := FindControl(h);
      
      if WinControl is tlabel then  tlabel(WinControl).caption:='aaa';
      if WinControl is tedit then  tedit(WinControl).text:='aaa';
    end;调用:
    fun1(label1.handle);
    fun1(edit1.handle);
      

  5.   

    procedure Doit(Obt:TObject);
    begin
      if (obt is TLabel) then
          (obt as TLabel).caption:=' ';
      if (obt is TEdit) then
          (obt as TEdit).text:=' ';
    end;
    ---------
    还是学习一下了!
      

  6.   

    好像只能用API函数哦
    或用消息系统函数