COM: invoke routine

Hello,

Consider this routine:

var v:variant;
begin
v:=CreateOleObject('Word.Basic');
v.AppShow
end;

Instead of using "v.AppShow" I want to use "v.invoke(params...)" to launch the "AppShow" procedure.

But I have no clue about how to get all those odd params.


Cheers

Isi
Isi041999Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
intheConnect With a Mentor Commented:
thanks glad to hear you still alive :-)
0
 
Isi041999Author Commented:
Edited text of question.
0
 
intheCommented:
null
0
 
intheCommented:
a bit of cut'n'paste that may give some pointers:

uses
  ComObj, ActiveX;
 
procedure TForm1.Button3Click(Sender: TObject);
const
  LOCAL_NEUTRAL = // =0
    (SORT_DEFAULT shl 16) or
    (SUBLANG_NEUTRAL shl 10) or
    LANG_NEUTRAL;
var
  v: olevariant;
  SASDisp: IDispatch;
  Member: WideString;
  pMember: pWidechar;
  DispID: integer;
  lcid: Tlcid;
  VarResult, ExcepInfo, ArgErr: Pointer;
  Flags: Word;
  Params: pointer;
 
  SASVisiStat: boolean;
  actSASVisiStat: variant;
  SASExcepInfo: tagExcepInfo;
  SASArgErr: cardinal;      { unsigned int }
 
begin
  v:= CreateOleObject('SAS.Application');
  SASDisp:= v;
  Member:= 'VISIBLE';
  { Aufruf via VB: SAS.visible = TRUE }
  pMember:= @Member[1];
  (*lcid:= LOCALE_SYSTEM_DEFAULT;
   (*lcid:= LOCALE_USER_DEFAULT;  (* oder so?*)
  lcid:= LOCAL_NEUTRAL;

  OLECheck(
    SASDisp.GetIDsOfNames(
      GUID_NULL,
      @pMember,
      1,
      lcid,
      @DispID
    )
  );
  ShowMessage(IntToStr(DispID));
 (*prepare Flags, Params, VarResult, ExcepInfo, ArgErr *)
  Flags := DISPATCH_PROPERTYPUTREF;
  SASVisiStat := TRUE;
  Params    := @SASVisiStat;
  VarResult := @actSASVisiStat;
  ExcepInfo := @SASExcepInfo;
  ArgErr    := @SASArgErr;
 
  OLECheck(
SASDisp.Invoke(DispID,GUID_NULL,lcid,Flags,Params,VarResult,ExcepInfo,ArgErr));
end;

hope that helps
Regards Barry
0
 
Isi041999Author Commented:
Thanks Barry.

That was exactly what I was looking for. You just saved my life

Cheers

Isi
0
All Courses

From novice to tech pro — start learning today.