1 Reply Latest reply: Aug 19, 2014 1:54 PM by Ricardo Av-Oracle RSS

    Gets wrong EventID in OnonFileEvent(..) of AutoVue Desktop Deployment.

    1489025

      Gets wrong EventID in OnonFileEvent(..) of AutoVue Desktop Deployment.

       

      Following is part of code written in Delphi 5:

       

      procedure TfrmTest.AutoVueViewFileEvent(Sender : TObject; const arg0 : IDispatch);

      const

        dispparamsNoArgs : TDispParams = ( rgvarg : NIL; rgdispidNamedArgs: NIL; cArgs : 0; cNamedArgs: 0 );

      var

        sMethodName : Widestring;

        iDispId : longint;

        v : Variant;

      begin

        sMethodName := 'getEventID';

        arg0.GetIDsOfNames (GUID_NULL, @sMethodName, 1, LOCALE_SYSTEM_DEFAULT, @iDispId);

        arg0.Invoke (iDispId, GUID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, dispparamsNoArgs, @v, NIL, NIL);

        if (iDispId = EVENTID_FILEEVNT_ONPAGELOADED) then

          AutoVueXDesktop.printIt();

      end;

       

      Procedure AutoVueViewFileEvent(..) is assigned to OnonFileEvent of AutoVue.

       

      But we never get Event ID as EVENTID_FILEEVNT_ONPAGELOADED (i.e. 18), we always get value like 32770

       

      EXPECTED BEHAVIOR

      -----------------------

      Need to get Event ID as EVENTID_FILEEVNT_ONPAGELOADED once file loaded completely in viewer.

        • 1. Re: Gets wrong EventID in OnonFileEvent(..) of AutoVue Desktop Deployment.
          Ricardo Av-Oracle

          I would recommend you review the code you are using and ensure you test for return codes

          The id you always get is the one for the function you are trying to look for, so the behavior you see is expected

          Please review IDispatch::Invoke prototype

          HRESULT Invoke(

            [in]       DISPID dispIdMember,

            [in]       REFIID riid,

            [in]       LCID lcid,

            [in]       WORD wFlags,

            [in, out]  DISPPARAMS *pDispParams,

            [out]      VARIANT *pVarResult,

            [out]      EXCEPINFO *pExcepInfo,

            [out]      UINT *puArgErr

          );

           

          You should be testing the result, in your case v, not the function ID