VirtualBox

Changeset 29874 in vbox for trunk/src/VBox


Ignore:
Timestamp:
May 28, 2010 6:14:44 PM (15 years ago)
Author:
vboxsync
Message:

first draft of OLE events support

Location:
trunk/src/VBox/Main
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/VirtualBoxImpl.cpp

    r29864 r29874  
    44634463}
    44644464
     4465
    44654466////////////////////////////////////////////////////////////////////////////////
    44664467
     
    44984499#if 0
    44994500    // WIP
     4501
     4502    LPTYPEINFO       ptinfo;
     4503    HRESULT          hr;
     4504    LPTYPELIB        ptlib;
     4505    DISPID           dispid;
     4506
     4507    /* Real solution must cache all needed dispids once, ofc */
     4508    hr = ::LoadRegTypeLib(LIBID_VirtualBox, kTypeLibraryMajorVersion, kTypeLibraryMinorVersion, LOCALE_SYSTEM_DEFAULT, &ptlib);
     4509    hr = ptlib->GetTypeInfoOfGuid(IID_IVirtualBoxCallback, &ptinfo);
     4510    ptlib->Release();
     4511
     4512    OLECHAR FAR* szMember = L"OnMachineStateChange";
     4513
     4514    hr = ::DispGetIDsOfNames(ptinfo, &szMember, 1, &dispid);
     4515    ptinfo->Release();
     4516
    45004517    int nConnections = mVirtualBox->m_vec.GetSize();
    45014518    for (int i=0; i<nConnections; i++)
    45024519    {
    4503         CComPtr<IUnknown> sp = mVirtualBox->m_vec.GetAt(i);
    4504         IVirtualBoxCallback* cb = reinterpret_cast<IVirtualBoxCallback*>(sp.p);
    4505         if (cb != NULL)
    4506         {
    4507             HRESULT hrc = handleCallback(cb);
     4520        ComPtr<IUnknown> sp = mVirtualBox->m_vec.GetAt(i);
     4521        ComPtr<IVirtualBoxCallback> cbI;
     4522        ComPtr<IDispatch> cbD;
     4523   
     4524        cbI = sp;
     4525        cbD = sp;
     4526
     4527        /**
     4528         * Would be like this in ideal world, unfortunately our consumers want to be invoked via IDispatch,
     4529         * thus going the hard way.
     4530         */
     4531#if 0   
     4532        if (cbI != NULL)
     4533        {   
     4534            HRESULT hrc = handleCallback(cbI);
    45084535            if (hrc == VBOX_E_DONT_CALL_AGAIN)
    45094536            {
    45104537                // need to handle that somehow, maybe just set element to 0
    45114538            }
     4539        }
     4540#endif
     4541        if (cbI != NULL && cbD != NULL)
     4542        {
     4543             CComVariant varResult, arg1, arg2;
     4544
     4545             ::VariantClear(&varResult);
     4546             ::VariantClear(&arg1);
     4547             ::VariantClear(&arg2);
     4548             
     4549             VARIANTARG args[] = {arg1, arg2};
     4550             DISPPARAMS disp = { args, NULL, sizeof(args)/sizeof(args[0]), 0};
     4551
     4552             cbD->Invoke(dispid, IID_NULL,
     4553                         LOCALE_USER_DEFAULT,
     4554                         DISPATCH_METHOD,
     4555                         &disp, &varResult,
     4556                         NULL, NULL);
    45124557        }
    45134558    }
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r29864 r29874  
    1452914529           namespace="virtualbox.org">
    1453014530      <interface name="IVirtualBox" default="yes"/>
     14531      <eventsink name="IVirtualBoxCallback" default="yes"/>
    1453114532    </class>
    1453214533  </module>
     
    1453614537           namespace="virtualbox.org">
    1453714538      <interface name="ISession" default="yes"/>
     14539      <eventsink name="IConsoleCallback" default="yes"/>
     14540
    1453814541    </class>
    1453914542    <class name="CallbackWrapper" uuid="49EE8561-5563-4715-B18C-A4B1A490DAFE"
  • trunk/src/VBox/Main/idl/midl.xsl

    r29200 r29874  
    630630    </xsl:if>
    631631    <xsl:text>interface </xsl:text>
     632    <xsl:value-of select="@name"/>
     633    <xsl:text>;&#x0A;</xsl:text>
     634  </xsl:for-each>
     635  <xsl:for-each select="eventsink">
     636    <xsl:text>    </xsl:text>
     637    <xsl:choose>
     638      <xsl:when test="@default='yes'"><xsl:text>[default,source]</xsl:text></xsl:when>
     639      <xsl:otherwise><xsl:text>[source]</xsl:text></xsl:otherwise>
     640    </xsl:choose>
     641    <xsl:text> interface </xsl:text>
    632642    <xsl:value-of select="@name"/>
    633643    <xsl:text>;&#x0A;</xsl:text>
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette