views:

151

answers:

2

Hi!!!

I am setting up a module of "bpl" load in IntraWeb, Delphi2010, and I found the following problem:
I don't get to create an instance the application to not to be this is as an internal form.
.

procedure CargaDoSubModulo;
type
  TIWFormClass = class of TIWForm;

var
  Integra : IIntegracaoIW;
  Formulario : TIWForm;
  intClas : Integer;
  strForm : String;

begin
  strForm := srtPacotes + '_' + Copy ( IntToStr ( Rtn_Alternativa)  + 10000 ), 2, 4 );

// Descrição do formulário
  strDescricaoTela := Des_Tela;
// Nome da classe do formulário
  vrtClasseModulo := 'p_' + strForm + '.dll';

// Nome da rotina interna a ser carregada
  strForm := 'iwfrm_' + strForm;
// Nome da classe do formulário
  vrtNomeFormulario := 'T'    + strForm;
// Verificação se a rotina e compativel com o sistema iwfrm_hrb_0010
  intClas := -1;

  if WebApplication.FindComponent( strForm ) = nil then
  begin
     Formulario := TIWFormClass(FindClass( vrtNomeFormulario )).Create(WebApplication);

     if not Supports (Formulario, IIntegracaoIW) then
     begin
        WebApplication.ShowMessage(CargaTexto(msnRotIncompIntgra), smAlert);
        Exit;
     end;

     Integra := Formulario as IIntegracaoIW;
     with Integra do
     begin
        SetServidor( ParServidor1.Servidor );                             // 1
        SetAreaTrabalho( ParServidor1.AreaTrabalho );                     // 2
        SetIdUsuario( intUsuario );                                       // 3
        SetNomeUsuario( iwlStUsuario.Caption );                           // 11
        SetAcesso( intAcesso );                                           // 4
        SetEmpresa( ParServidor1.Empresa );                               // 5
        SetFilial( ParServidor1.Filial );                                 // 6
        SetIdClasse( intClas );                                           // 8
        SetVersao( strVersaoInterna );                                    // 10
        SetDescricao(Des_Tela );     // 7
        SetEnderecoIP( strIdentificacaoPorta );                           // 13
        SetDataTrabalho( DateToStr(dtDataTrabalho) );                     // 14
        SetIdentificacaoSistema( iwlIdentificacao.Caption );              // 12
        SetModuloCarga(Rtn_Busca ); // 9
     end;
  end;
  TIWAppForm(WebApplication.FindComponent( strForm )).Show;

end;

A: 

só olhei bem...

Amir
Amir, please delete this answer - it is not really an answer, and this is an English-only site.
Argalatyr
+1  A: 

Your question - or actually the exact problem/error - is a bit unclear to me. Locating a form via FindComponent is a bit uncommon. At least you shouldn't call FindComponent more than nessecary, as it is potentially slow.

If you create a Form with WebApplication being the owner, it will be added to WebApplication.Forms Web Application.FormCount is the number of forms (UserSession is a form in this context). WebApplication.ActiveForm is the form that is currently shown.

Olaf Monien