Fabulous Adventures In Coding

Eric Lippert's Blog

binder.h

#ifndef BINDER_H // {
#define BINDER_H

class Binder : public IDispatch
{

protected:

    class Name
    {
    public:

        Name();
        ~Name();
       
        HRESULT SetValue(VARIANTARG * pvar);
        HRESULT GetValue(VARIANT * pvar);
        BOOL IsFunction(void);
        HRESULT ExecuteFunction(UINT cArgs, VARIANTARG * rgvarArgs, VARIANT * pvarResult);

        VARIANT m_var;
    };

public:

    static HRESULT Create(Binder * * ppBinder);

    // IUnknown
    STDMETHOD(QueryInterface)(REFIID riid, void * * ppv);
    STDMETHOD_(ULONG,AddRef)(void);
    STDMETHOD_(ULONG,Release)(void);
   
    // IDispatch
    STDMETHOD(GetTypeInfoCount)(UINT * pcTypeInfo);
    STDMETHOD(GetTypeInfo)(UINT iTypeInfo, LCID lcid, ITypeInfo * * ppTypeInfo);
    STDMETHOD(GetIDsOfNames)(REFIID riid, WCHAR * * rgpszNames, UINT cNames,
        LCID lcid, DISPID * rgdispids);
    STDMETHOD(Invoke)(DISPID dispid, REFIID riid, LCID lcid, WORD flags,
        DISPPARAMS * pDispParams, VARIANT * pvarResult, EXCEPINFO * pExcepInfo,
        UINT * pError);

protected:

    long m_cref;
    DWORD m_thread;

    Binder();
    virtual ~Binder();

    HRESULT VerifyThread(void);
    HRESULT GetIdOfName(const WCHAR * pszName , DISPID * pdispid);
    HRESULT GetNameById(DISPID dispid, Name * * ppName);

};

#endif // BINDER_H }

 

Published Tuesday, May 04, 2004 10:01 AM by Eric Lippert
Filed under:

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

No Comments

Leave a Comment

(required) 
(optional)
(required) 
Submit

This Blog

Syndication


© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Microsoft
Page view tracker