VBA in a dialog based application

Last post 03-06-2008, 11:03 AM by jimg. 2 replies.
Sort Posts: Previous Next
  •  03-04-2008, 5:26 AM 928

    VBA in a dialog based application

    I want to integrate VBA in a dialog based application (MFC). I have created an event interface and this works perfect for the main dialog. But if I fire events out of other dialogs, then they don't reach VBA.

    I'd be glad for every help!

    The Code for the "fire"-method at  a class derived from IConnectionPointImpl looks like this:

    VOID Test(long lData)
    {
      T* pT = static_cast<T*>(this);
      CComVariant* pvars = new CComVariant[1];
      IUnknown** ppunk;
        
      for (ppunk = m_vec.begin(); ppunk < m_vec.end(); ppunk++)
      {
        pT->Lock();
        CComPtr<IUnknown> sp = *ppunk;
        pT->Unlock();
        IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
        if (pDispatch != NULL)
        {
          pvars[0] =
    lData;
          DISPPARAMS disp = { pvars, NULL, 1, 0 };
          pDispatch->Invoke(0x1, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
        }
      }
      delete[] pvars;
    }

  •  03-06-2008, 2:03 AM 939 in reply to 928

    Re: VBA in a dialog based application

    OK I solved my problem, but I have another one:
    Now I have developed my application which has an integration of VBA. But if I want to run it on another PC, then it doesn't work, because the VBA SDK is not installed. Can you tell what I have to do? I don't want to install the SDK again...
  •  03-06-2008, 11:03 AM 940 in reply to 939

    Re: VBA in a dialog based application

    You need to install VBA.

    You can find more information, regarding Installing VBA with your application, in the vba6sdk.chm file located in the root of the VBA6SDK install directory.

    I suggest you read through the Instlling VBA with an Application help topic.

    Jim G

     

     

     

View as RSS news feed in XML