comctl32/button: Use messages to get control text.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2018-02-13 16:19:57 +03:00 committed by Alexandre Julliard
parent b6ca8fd25d
commit 65f23a745a

View file

@ -223,9 +223,10 @@ static inline void paint_button( HWND hwnd, LONG style, UINT action )
/* retrieve the button text; returned buffer must be freed by caller */
static inline WCHAR *get_button_text( HWND hwnd )
{
static const INT len = 512;
INT len = GetWindowTextLengthW( hwnd );
WCHAR *buffer = HeapAlloc( GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR) );
if (buffer) InternalGetWindowText( hwnd, buffer, len + 1 );
if (buffer)
GetWindowTextW( hwnd, buffer, len + 1 );
return buffer;
}