diff --git a/dlls/comctl32/button.c b/dlls/comctl32/button.c index 2f5a5b3f170..dccddf9f527 100644 --- a/dlls/comctl32/button.c +++ b/dlls/comctl32/button.c @@ -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; }