Retrieve a function from a library, and set the data types.
(libname, funcname, restype=None, argtypes=(), _libcache={})
| 85 | TIMEOUT_ASYNC = 0xFFFFFFFF |
| 86 | |
| 87 | def get_winfunc(libname, funcname, restype=None, argtypes=(), _libcache={}): |
| 88 | """Retrieve a function from a library, and set the data types.""" |
| 89 | from ctypes import windll |
| 90 | |
| 91 | if libname not in _libcache: |
| 92 | _libcache[libname] = windll.LoadLibrary(libname) |
| 93 | func = getattr(_libcache[libname], funcname) |
| 94 | func.argtypes = argtypes |
| 95 | func.restype = restype |
| 96 | |
| 97 | return func |
| 98 | |
| 99 | |
| 100 | DDECALLBACK = WINFUNCTYPE(HDDEDATA, UINT, UINT, HCONV, HSZ, HSZ, HDDEDATA, |
no outgoing calls
no test coverage detected