EM_GETLINE,Win32gui, address of buffer

Neil Hodgson nhodgson at bigpond.net.au
Wed Dec 19 06:28:39 CET 2001

> When I use the message, EM_GETLINE, the lParam calls for
> an address of a string buffer. How do I prepare this buffer in Python?

   Use the array module to create a buffer of a reasonable size and then
find its address as the first element of the tuple returned by the
buffer_info method.

>>> import array
>>> b = array.array('c', 'x'*1000)
>>> b.buffer_info()
(15080104, 1000)

   Ensure that the buffer object's life outlives your use of the address.


More information about the Python-list mailing list