[docs] [issue21903] ctypes documentation MessageBoxA example produces error

Dan O'Donovan report at bugs.python.org
Wed Jul 2 12:50:32 CEST 2014


Dan O'Donovan added the comment:

Ok, this fail is happening because we're using python3 unicode strings to call the ANSI MessageBoxA function. A possible fix;

Encode strings before passing the MessageBoxA (ctypes.txt.diff attached)

Alternatively, calls could be made to the unicode MessageBoxW function, but someone who knows about ctypes / Win32 magic numbers would have to look at that.

(Inspiration take from this stack overflow question http://stackoverflow.com/questions/18164994/the-ctypes-wraps-messageboxa-example-didnt-work-in-python33)

----------
keywords: +patch
Added file: http://bugs.python.org/file35828/ctypes.txt.diff

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21903>
_______________________________________


More information about the docs mailing list