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) 

  
Enter Code Here: Required
Submit

About Eric Lippert

Eric Lippert is a senior developer on the Microsoft C# compiler team. Before that he worked on the framework of Visual Studio Tools For Office. Before that, he worked on the compilers, runtimes and tools for VBScript, JScript, Windows Script Host and other Microsoft Scripting technologies. He lives in Seattle and spends his free time editing books about programming languages, playing the piano, and trying to keep his tiny sailboat upright in Puget Sound.

This Blog

Syndication


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