Python pythoncom 模块,VT_HRESULT 实例源码

我们从Python开源项目中,提取了以下1个代码示例,用于说明如何使用pythoncom.VT_HRESULT

项目:My-Web-Server-Framework-With-Python2.7    作者:syjsu    | 项目源码 | 文件源码
def setArray(self, oInterface, sAttrib, aoArray):
        #
        # HACK ALERT!
        #
        # With pywin32 build 218, we're seeing type mismatch errors here for
        # IGuestSession::environmentChanges (safearray of BSTRs). The Dispatch
        # object (_oleobj_) seems to get some type conversion wrong and COM
        # gets upset.  So, we redo some of the dispatcher work here, picking
        # the missing type information from the getter.
        #
        oOleObj     = getattr(oInterface, '_oleobj_');
        aPropMapGet = getattr(oInterface, '_prop_map_get_');
        aPropMapPut = getattr(oInterface, '_prop_map_put_');
        sComAttrib  = sAttrib if sAttrib in aPropMapGet else ComifyName(sAttrib);
        try:
            aArgs, aDefaultArgs = aPropMapPut[sComAttrib];
            aGetArgs            = aPropMapGet[sComAttrib];
        except KeyError: # fallback.
            return oInterface.__setattr__(sAttrib, aoArray);

        import pythoncom;
        oOleObj.InvokeTypes(aArgs[0],                   # dispid
                            aArgs[1],                   # LCID
                            aArgs[2],                   # DISPATCH_PROPERTYPUT
                            (pythoncom.VT_HRESULT, 0),  # retType - or void?
                            (aGetArgs[2],),             # argTypes - trick: we get the type from the getter.
                            aoArray,);                  # The array