/Lib/ctypes/test/test_errcheck.py

http://unladen-swallow.googlecode.com/ · Python · 19 lines · 2 code · 6 blank · 11 comment · 0 complexity · a02b9acbf9cf3ce22acc19d19dc6f8e1 MD5 · raw file

  1. import sys
  2. from ctypes import *
  3. ##class HMODULE(Structure):
  4. ## _fields_ = [("value", c_void_p)]
  5. ## def __repr__(self):
  6. ## return "<HMODULE %s>" % self.value
  7. ##windll.kernel32.GetModuleHandleA.restype = HMODULE
  8. ##print windll.kernel32.GetModuleHandleA("python23.dll")
  9. ##print hex(sys.dllhandle)
  10. ##def nonzero(handle):
  11. ## return (GetLastError(), handle)
  12. ##windll.kernel32.GetModuleHandleA.errcheck = nonzero
  13. ##print windll.kernel32.GetModuleHandleA("spam")