Huw Davies : comdlg32: Select the correct font before querying the extents.

Alexandre Julliard julliard at winehq.org
Fri May 5 15:05:59 CDT 2017


Module: wine
Branch: master
Commit: 5d9ab56d9e49fd026c66edd54604ecd08c8259f0
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=5d9ab56d9e49fd026c66edd54604ecd08c8259f0

Author: Huw Davies <huw at codeweavers.com>
Date:   Fri May  5 12:36:21 2017 +0100

comdlg32: Select the correct font before querying the extents.

Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/comdlg32/itemdlg.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/dlls/comdlg32/itemdlg.c b/dlls/comdlg32/itemdlg.c
index 92499e6..3096017 100644
--- a/dlls/comdlg32/itemdlg.c
+++ b/dlls/comdlg32/itemdlg.c
@@ -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)




More information about the wine-cvs mailing list