EM_GETLINE,Win32gui, address of buffer

Mark_Pryor erlangen72 at hotmail.com
Wed Dec 19 15:04:30 EST 2001


Hi Neil,
Neil Hodgson <nhodgson at bigpond.net.au> wrote in message news:bAVT7.24607$_z.71369 at news-server.bigpond.net.au...
> Mark_Pryor:
> > 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.
> 
>    Neil

First time I have seen a buffer set up that way, thanks.

As for my original goal of scraping from the UEdit edit control, well
it was a bad idea in the first place. After failing over and over I ran Spy
on the window to find out that the EM_GETLINE message is never
used internally by UEdit. 

My technique could only work if the App subclassed for this message
and was prepared to handle it - a silly assumption to begin with. Now
I shall try to force a line select on the Caret line, then use UEdits advanced
menu to shell out the text. 

Almost anything I want to try I have found a way to do it in Python :)

cheers,
Mark




More information about the Python-list mailing list