[python-win32] win32api handle incompatible with ctypes?

Kurt Eilander webguy at totalrewind.com
Sat Mar 4 19:16:09 EST 2017


Hey all,

I'm having another problem.  I'm wanting to get the size of a dll 
resource, but...

When I do:
     try:
         hLib=win32api.GetModuleHandle(fileName)
     except:
         hLib=win32api.LoadLibrary(fileName)
     if hLib==None:
         raise WindowsError('File not found, '+fileName)
     hResInfo=ctypes.windll.kernel32.FindResourceW(hLib,index,type)
     size=ctypes.windll.kernel32.SizeofResource(hLib,hResInfo)

It throws:
     hResInfo=ctypes.windll.kernel32.FindResourceW(hLib,index,type)
     ctypes.ArgumentError: argument 1: <type 
'exceptions.OverflowError'>: long int too long to convert

Almost like ctypes doesn't like the win32api handle.

My machine is 64 bit.  Is that what ctypes is not liking?  Is there a 
way around it?

-Kurt


More information about the python-win32 mailing list