當前位置: 首頁>>代碼示例>>Python>>正文


Python ctypes.OleDLL方法代碼示例

本文整理匯總了Python中ctypes.OleDLL方法的典型用法代碼示例。如果您正苦於以下問題:Python ctypes.OleDLL方法的具體用法?Python ctypes.OleDLL怎麽用?Python ctypes.OleDLL使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ctypes的用法示例。


在下文中一共展示了ctypes.OleDLL方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: CoCreateInstanceC2R

# 需要導入模塊: import ctypes [as 別名]
# 或者: from ctypes import OleDLL [as 別名]
def CoCreateInstanceC2R (self, store, reg, clsid, iid) :
        # Ugly code to find DLL in C2R version of COM object and get a COM
        # object despite the fact that COM doesn't handle C2R
        try:
            # Get DLL to load from 2R register 
            aReg = winreg.ConnectRegistry(None, store)
            aKey = winreg.OpenKey(aReg, reg, 0, winreg.KEY_READ | winreg.KEY_WOW64_64KEY)
            dummy_n, IconvDLL, dummy_t = winreg.EnumValue(aKey, 0)
            winreg.CloseKey(aKey)
            winreg.CloseKey(aReg)
            
            # Create OLE object from DLL
            IconvOLE = ctypes.OleDLL(IconvDLL)
            
            # Get COM Instance from OLE 
            clsid_class = uuid.UUID(str(clsid)).bytes_le
            iclassfactory = uuid.UUID(str(pythoncom.IID_IClassFactory)).bytes_le
            com_classfactory = ctypes.c_long(0)
            IconvOLE.DllGetClassObject(clsid_class, iclassfactory, ctypes.byref(com_classfactory))
            MyFactory = pythoncom.ObjectFromAddress(com_classfactory.value, pythoncom.IID_IClassFactory)
            return MyFactory.CreateInstance (None, str(iid))
        except:
            return None 
開發者ID:adb014,項目名稱:nsf2x,代碼行數:25,代碼來源:mapiex.py

示例2: set_dpi_aware

# 需要導入模塊: import ctypes [as 別名]
# 或者: from ctypes import OleDLL [as 別名]
def set_dpi_aware():
    # https://stackoverflow.com/questions/36134072/setprocessdpiaware-seems-not-to-work-under-windows-10
    # https://bugs.python.org/issue33656
    # https://msdn.microsoft.com/en-us/library/windows/desktop/dn280512(v=vs.85).aspx
    # https://github.com/python/cpython/blob/master/Lib/idlelib/pyshell.py
    if sys.platform == "win32":
        try:
            import ctypes

            PROCESS_SYSTEM_DPI_AWARE = 1
            ctypes.OleDLL("shcore").SetProcessDpiAwareness(PROCESS_SYSTEM_DPI_AWARE)
        except (ImportError, AttributeError, OSError):
            pass 
開發者ID:thonny,項目名稱:thonny,代碼行數:15,代碼來源:__init__.py

示例3: lib

# 需要導入模塊: import ctypes [as 別名]
# 或者: from ctypes import OleDLL [as 別名]
def lib(self):
        """Returns the reference to the loaded library object.

        For example, if `libtype` is

            * ``'cdll'`` then a :class:`~ctypes.CDLL` object
            * ``'windll'`` then a :class:`~ctypes.WinDLL` object
            * ``'oledll'`` then a :class:`~ctypes.OleDLL` object
            * ``'net'`` or ``'clr'`` then a :class:`~.load_library.DotNet` object
            * ``'java'`` then a :class:`~py4j.java_gateway.JVMView` object
            * ``'com'`` then the interface pointer returned by comtypes.CreateObject_
        """
        return self._lib 
開發者ID:MSLNZ,項目名稱:msl-loadlib,代碼行數:15,代碼來源:load_library.py


注:本文中的ctypes.OleDLL方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。