comdlg32: Select the correct font before querying the extents.

Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Huw Davies 2017-05-05 12:36:21 +01:00 committed by Alexandre Julliard
parent e77771c0bf
commit 5d9ab56d9e
1 changed files with 4 additions and 0 deletions

View File

@ -862,6 +862,7 @@ static void ctrl_resize(HWND hctrl, UINT min_width, UINT max_width, BOOL multili
RECT rc;
HDC hdc;
WCHAR *c;
HFONT font;
TRACE("\n");
@ -871,7 +872,10 @@ static void ctrl_resize(HWND hctrl, UINT min_width, UINT max_width, BOOL multili
SendMessageW(hctrl, WM_GETTEXT, len+1, (LPARAM)text);
hdc = GetDC(hctrl);
font = (HFONT)SendMessageW(hctrl, WM_GETFONT, 0, 0);
font = SelectObject(hdc, font);
GetTextExtentPoint32W(hdc, text, lstrlenW(text), &size);
SelectObject(hdc, font);
ReleaseDC(hctrl, hdc);
if(len && multiline)