MCPcopy Create free account
hub / github.com/ActiveState/code / get_winfunc

Function get_winfunc

recipes/Python/577654_DDE_Client/recipe-577654.py:87–97  ·  view source on GitHub ↗

Retrieve a function from a library, and set the data types.

(libname, funcname, restype=None, argtypes=(), _libcache={})

Source from the content-addressed store, hash-verified

85TIMEOUT_ASYNC = 0xFFFFFFFF
86
87def 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
100DDECALLBACK = WINFUNCTYPE(HDDEDATA, UINT, UINT, HCONV, HSZ, HSZ, HDDEDATA,

Callers 2

DDEClass · 0.85
WinMSGLoopFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected