for i=0 to Application.ComponentCount do
begin
    if(Application->Components[i].Name =='Form1')then    begin
    TForm1(Application->Components[i]).Caption='123';   
     ...
    end;
end;

解决方案 »

  1.   

    一号补丁:
    for i=0 to Application.ComponentCount do
    begin
        if(Application->Components[i].Name ='Form1')then    begin
        TForm1(Application->Components[i]).Caption := '123';  
        ...
        end;
    end; 
      

  2.   

    sp2:
    for i := 0 to Application.ComponentCount - 1 do
      if Application.Components[i].Name = 'Form1' then
      begin
        TForm(Application.Components[i]).Caption := '123';  
        break;
      end;
      

  3.   

    procedure TForm1.Button1Click(Sender: TObject);
    var
      vFormClass: TFormClass;
    begin
      vFormClass := TFormClass(GetClass('TForm1')); //GetClass()返回根据名称搜索的类
      if Assigned(vFormClass) then
        with vFormClass.Create(Self) do try
          ShowModal;
        finally
          Free;
        end;
    end;procedure TForm1.FormCreate(Sender: TObject);
    begin
      RegisterClass(TForm1); //需要注册
    end;procedure TForm1.FormDestroy(Sender: TObject);
    begin
      UnRegisterClass(TForm1); //注销
    end;