Re: ctmswgui vs ctypes-0.6.0
Robin Becker <[email protected]> Tue, 6 May 2003 19:49:44 +0100
| Newsgroups | gmane.comp.python.anygui.devel |
|---|---|
| Message-ID | <[email protected]> |
In article <[email protected]>, Thomas Heller <[email protected]> writes >Robin Becker <[email protected]> writes: ...... thanks for this, I suspected that this was the way to go. >You would probably create a subclass of WinDLL, and use an instance of >it. Here's the ctypes.WinDLL source, straight from ctypes/__init__.py: > > class WinDLL(CDLL): > class _StdcallFuncPtr(_CFuncPtr): > _flags_ = _FUNCFLAG_STDCALL > _restype_ = c_int # default, can be overridden in instances > > def __getattr__(self, name): > if name[:2] == '__' and name[-2:] == '__': > raise AttributeError, name > func = self._StdcallFuncPtr(name, self) > setattr(self, name, func) > return func > >So changing your WinDLL to this one should do (untested): actually I suspect you did the initial version of this :) >class WinDLL(ctypes.WinDLL): > > def __getattr__(self, name): > if name[:2] == '__' and name[-2:] == '__': > raise AttributeError, name > try: > func = self._StdcallFuncPtr(name, self) > except: > func = self._StdcallFuncPtr(name+_apiMode, self) > setattr(self, name, func) > return func > > >Let me know if you need further help, > >Thomas The window proc functions are all declared thusly class WINDOWPROC(CFunction): _types_ = "iiii" _stdcall_ = 1 Does this have to be WINDOPROC=WINFUNCTYPE(c_int,c_int,c_int,c_int)? -- Robin Becker ------------------------------------------------------- Enterprise Linux Forum Conference & Expo, June 4-6, 2003, Santa Clara The only event dedicated to issues related to Linux enterprise solutions www.enterpriselinuxforum.com