Bonjour,

J'ai un problème depuis XE2 avec le passage d'un paramètre par référence d'un tableau de variants à une fonction.
J'ai le message suivant :
Le projet Pxxx.exe a déclenché la chasse d'exception EOleException avec le message 'Type Mismatch in monParametreFonction for Objet.FunctionCall() Method. Pass an array by Reference'.

Mon code est le suivant :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
 
type
  TObRunParams = record
    pIN: OleVariant;
    pOUT: OleVariant;
  end;
 
  TMonObjet = class(...)
  private
    FObApp: OleVariant;
    FObFct: OleVariant;
  public
    property ObApp: OleVariant read FObApp Write FObApp;
    property ObFct: OleVariant read FObFct Write FObFct;
    procedure CallObFct();
  end;
 
procedure TMonObjet .AppelFonction;
var
   Params: TObRunParams;
begin
    Params.pIN := VarArrayCreate([0, 1], varVariant);
    Params.pOUT := VarArrayCreate([0, 3], varVariant);
    FObApp := CreateOleObject('Monapp');
    FObFct := FObApp.Function(aFncFileNme, aFncImplNme);
    ObFct.Call(VarArrayRef(aParams.pIN), VarArrayRef(aParams.pOUT)); ==> // Plantage
end;
Une idée ?

D'avance merci