[IronPython] ctypes.py from FePy

Michael Foord fuzzyman at voidspace.org.uk
Mon Apr 7 18:54:56 CEST 2008


Hello all,

I've been trying to use ctypes.py from FePy for dynamic platform invoke. 
Unfortunately it doesn't appear to work...

I'm trying to follow the example at:

http://www.ironpython.info/index.php/Access_Unmanaged_Code_with_Dynamic_P/Invoke

Unfortunately 'WDLL' doesn't exist in ctypes. If I replace it with 
'CDLL' it blows up with the following error:

 >>> usr = pinvoke.CDLL("user32.dll")
 >>> WM_KEYDOWN = 0x100
 >>> HWND_BROADCAST = 0xFFFF
 >>> usr.PostMessage(HWND_BROADCAST, WM_KEYDOWN, ord('a'), 0)
Traceback (most recent call last):
  File , line 0, in <stdin>##88
  File pinvoke, line unknown, in __call__
  File e:\Dev\ironpython1\pinvoke.py, line 173, in __call__
SystemError: Object reference not set to an instance of an object.


Anyone got any ideas?

I'm using it with IronPython 1.1 as ctypes needs modifying slightly for 
IP 2.

Thanks

Michael Foord
http://www.ironpythoninaction.com/



More information about the Ironpython-users mailing list