Figure 2   GetExternal and Invoke


STDMETHOD(GetExternal)(IDispatch** ppDispatch)
{
    *ppDispatch = this;
    return S_OK;
}

STDMETHODIMP CAtlBrCon::Invoke(DISPID dispidMember, REFIID riid, LCID lcid,
                               WORD wFlags, DISPPARAMS* pDispParams, 
                               VARIANT* pvarResult,
                               EXCEPINFO* pExcepInfo, UINT* puArgErr)
{
    switch (dispidMember)
    {
        case DISPID_SAYHELLO:
            SayHello();
            break;
        default:
            return DISP_E_MEMBERNOTFOUND;
    }

    return S_OK;
}

Figure 3   EnableAccelerator Parameters

nKeyCode The key code constant that specifies an accelerator key (vbKeyTab, vbKeyN, vbKeyO, and so on).
nVirtExtKey The virtual key code of an extended key, such as vbKeyControl, vbKeyAlt, or vbKeyShift. This parameter is optional and has a default value of 0.
bState The state of the accelerator key. True turns on the accelerator key and False turns it off. This parameter has a default value of True.


Figure 5   Download Control


STDMETHODIMP CAtlBrCon::Invoke(DISPID dispidMember, REFIID riid, LCID lcid,
                               WORD wFlags, DISPPARAMS* pDispParams,
                               VARIANT* pvarResult, EXCEPINFO*  pExcepInfo,
                               UINT* puArgErr)
{
    switch (dispidMember)
    {
        case DISPID_AMBIENT_DLCONTROL:
            *pvarResult = DLCTL_DLIMAGES|DLCTL_VIDEOS|
                          DLCTL_BGSOUNDS|DLCTL_NO_SCRIPTS;
            break;

        default:
            return DISP_E_MEMBERNOTFOUND;
    }

    return S_OK;
}