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


Python windll.LoadLibrary方法代碼示例

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


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

示例1: __start__

# 需要導入模塊: from ctypes import windll [as 別名]
# 或者: from ctypes.windll import LoadLibrary [as 別名]
def __start__(self):
        self.dll = None
        try:
            self.dll = windll.LoadLibrary("TellUsbD101.dll")
        except:
            raise eg.Exception("TellUsbD101.dll not found.") 
開發者ID:EventGhost,項目名稱:EventGhost,代碼行數:8,代碼來源:__init__.py

示例2: test_handler

# 需要導入模塊: from ctypes import windll [as 別名]
# 或者: from ctypes.windll import LoadLibrary [as 別名]
def test_handler(self):
        @count_calls
        def interrupt_polling():
            print('Caught CTRL-C!')

        from ctypes import windll
        from ctypes.wintypes import BOOL, DWORD

        kernel32 = windll.LoadLibrary('kernel32')

        # <http://msdn.microsoft.com/en-us/library/ms683155.aspx>
        GenerateConsoleCtrlEvent = kernel32.GenerateConsoleCtrlEvent
        GenerateConsoleCtrlEvent.argtypes = (DWORD, DWORD)
        GenerateConsoleCtrlEvent.restype = BOOL

        # Simulate CTRL-C event while handler is active.
        try:
            with allow_interrupt(interrupt_polling) as context:
                result = GenerateConsoleCtrlEvent(0, 0)
                # Sleep so that we give time to the handler to
                # capture the Ctrl-C event.
                time.sleep(0.5)
        except KeyboardInterrupt:
            pass
        else:
            if result == 0:
                raise WindowsError()
            else:
                self.fail('Expecting `KeyboardInterrupt` exception!')

        # Make sure our handler was called.
        self.assertEqual(interrupt_polling.__calls__, 1) 
開發者ID:birforce,項目名稱:vnpy_crypto,代碼行數:34,代碼來源:test_win32_shim.py

示例3: _link_library

# 需要導入模塊: from ctypes import windll [as 別名]
# 或者: from ctypes.windll import LoadLibrary [as 別名]
def _link_library(self, lib_path, convention):
        """Find and link the external librairy if only a path was provided.

        """
        if convention == 'cdll':
            return cdll.LoadLibrary(lib_path)
        elif convention == 'windll':
            return windll.LoadLibrary(lib_path)
        elif convention == 'oledll':
            return oledll.LoadLibrary(lib_path)
        else:
            raise ValueError('Convention cannot be {}'.format(convention)) 
開發者ID:MatthieuDartiailh,項目名稱:pyclibrary,代碼行數:14,代碼來源:ctypes.py

示例4: get_lsass_handle

# 需要導入模塊: from ctypes import windll [as 別名]
# 或者: from ctypes.windll import LoadLibrary [as 別名]
def get_lsass_handle():
	your_dll = windll.LoadLibrary(dll_path)
	_your_function = your_dll.your_function
	_your_function.argtypes = [] #I guess no args
	_your_function.restype  = c_void_p #this is basically a handle
	
	phandle = _your_function()

	return phandle 
開發者ID:skelsec,項目名稱:pypykatz,代碼行數:11,代碼來源:phandle_dll.py

示例5: get_winfunc

# 需要導入模塊: from ctypes import windll [as 別名]
# 或者: from ctypes.windll import LoadLibrary [as 別名]
def get_winfunc(libname, funcname, restype=None, argtypes=(), _libcache={}):
    """Retrieve a function from a library/DLL, and set the data types."""
    if libname not in _libcache:
        _libcache[libname] = windll.LoadLibrary(libname)
    func = getattr(_libcache[libname], funcname)
    func.argtypes = argtypes
    func.restype = restype
    return func 
開發者ID:devcartel,項目名稱:pymt5,代碼行數:10,代碼來源:ddeclient.py

示例6: get_winfunc

# 需要導入模塊: from ctypes import windll [as 別名]
# 或者: from ctypes.windll import LoadLibrary [as 別名]
def get_winfunc(libname, funcname, restype=None, argtypes=(), _libcache={}):
    """Retrieve a function from a library, and set the data types."""
    from ctypes import windll

    if libname not in _libcache:
        _libcache[libname] = windll.LoadLibrary(libname)
    func = getattr(_libcache[libname], funcname)
    func.argtypes = argtypes
    func.restype = restype

    return func 
開發者ID:EventGhost,項目名稱:EventGhost,代碼行數:13,代碼來源:dde.py


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