From a5e78ec91b1c59233260bc776a309804352cd817 Mon Sep 17 00:00:00 2001 From: Jonas Kümmerlin Date: Fri, 11 Jan 2019 22:17:00 +0100 Subject: ALF_Text(): use GetWindowText instead of sending WM_GETTEXT directly --- alf/alf.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/alf/alf.cpp b/alf/alf.cpp index 57059d2..f10bdd3 100644 --- a/alf/alf.cpp +++ b/alf/alf.cpp @@ -593,10 +593,10 @@ ALF_SetWidgetText(HWND parent, WORD id, const TCHAR *text) TCHAR * // free with HeapFree ALF_Text(HWND hwnd) { - int len = (int)SendMessage(hwnd, WM_GETTEXTLENGTH, 0, 0); + int len = GetWindowTextLengthA(hwnd); if (len > 0) { TCHAR *buf = (TCHAR*)HeapAlloc(GetProcessHeap(), HEAP_GENERATE_EXCEPTIONS|HEAP_ZERO_MEMORY, (len + 1)*sizeof(TCHAR)); - if (SendMessage(hwnd, WM_GETTEXT, 0, (LPARAM)buf)) { + if (GetWindowText(hwnd, buf, len)) { return buf; } else { HeapFree(GetProcessHeap(), 0, buf); -- cgit v1.2.3