May-18-2017, 11:22 PM
I am trying to call a function from a dll(A) that is loaded by another dll(B). (A) has a function exposed getDLL that returns a winapi handle to (B). I cannot for the life of me access functions from (B) via the handle. I either get c_void_p has not method or function... or I get the same for type c_long. I have tried both casting my returned handle as wintypes.hinstance and I have tried by setting the restype.
.... def testFunc(ADLL, CWD): import ctypes.wintypes ADLL.GetDLL.restype = ctypes.wintypes.HINSTANCE cp = c_char_p("{0}{1}".format(CWD, "B.dll")) B = A.GetDLL(cp) B.SomeFunction() #This fails with c_Long has no method or function .... cast(B, ctypes.wintypes.HINSTANCE).SomeFucntion() #This fails with c_void_p has no method or function .... ....