HRESULT IDispatch::Invoke(DISPID IdentifiantMethode, GUID *Inutile, LCID Langue, USHORT Options, DISPPARAMS *TablesParametres, VARIANT *Resultat, EXCEPINFO *Exception, UINT *NumeroParametreEnErreur);
Les paramètres sont transmis via le tableau TablesParametres et le résultat de l'appel est rangé dans Resultat.
Si l'exécution de la méthode est en échec alors :
#include <windows.h>
#include <winbase.h>
#include <ole2.h>
IDispatch *pIDispatch;
DISPID IdentifiantMethode;
DISPPARAMS TablesParametres[255];
VARIANT Resultat;
EXCEPINFO Exception;
UINT NumeroParametreEnErreur;
...
memset(Resultat,0,sizeof(VARIANT));
memset(Exception,0,sizeof(EXCEPINFO));
NumeroParametreEnErreur=0;
if (pIDispatch->Invoke(IdentifiantMethode, IID_NULL, DEFAULT_LANG, DISPATCH_METHOD, TablesParametres, &Resultat, &Exception, &NumeroParametreEnErreur)!=S_OK)
{
...
}
...