i can't connect word application from my form

Add-in Express™ Support Service
That's what is more important than anything else

i can't connect word application from my form
 
Guest


Guest


i can connect to word application from AddInModule but i can't connect word application from my form that shown from AddInModule
Posted 02 Jan, 2006 14:41:03 Top
Dmitry Kostochko


Add-in Express team


Posts: 2841
Joined: 2004-04-05
Hi Guest,

Try to pass the TAddInModule instance (Self) in the constructor of your form and use this reference. See the pseudo code below:


implementation

uses Form1;

{ TAddInModule }
 
procedure TAddInModule.DoShowMyForm(Sender: TObject);
begin
  MyForm := TMyForm.Create(Self);
  try
    MyForm.ShowModal;
  finally
    FreeAndNil(MyForm);
  end;
end;
 
(*---------------*)
unit Form1;

interface

uses MyAddIn_IMPL;

{ TMyForm }
 
type
  TMyForm = class(TForm)
  private
    FAddInModule: TAddInModule;
  public
    constructor Create(AOnwer: TComponent); override;
    procedure MyMethod;
  end;
 
constructor TMyForm.Create(AOnwer: TComponent);
begin
  inherited Create(AOwner);
  if AOwner is TAddInModule then
    FAddInModule := TAddInModule(AOwner);
end;
 
procedure TMyForm.MyMethod;
begin
  // TODO
  if Assigned(FAddInModule) then
    FAddInModule.WordApp. ;
end;


Posted 04 Jan, 2006 11:26:51 Top