winefile runtime warning; header controls

Martin Fuchs martin-fuchs at gmx.net
Mon Oct 14 17:27:33 CDT 2002


- winefile: Removed Warning "SetWindowText(0, ...)" when opening new windows

- dlls/comctl32/header.c: phdi->pszText is every time stored as Unicode, so 
call DrawTextW() instead of DrawTextA()
 This fixes display of header control labels in winefile.

Index: dlls/comctl32/header.c
===================================================================
RCS file: /home/wine/wine/dlls/comctl32/header.c,v
retrieving revision 1.48
diff -u -r1.48 header.c
--- dlls/comctl32/header.c	16 Jul 2002 01:14:46 -0000	1.48
+++ dlls/comctl32/header.c	14 Oct 2002 22:22:32 -0000
@@ -254,12 +254,9 @@
 	    GetObjectA (phdi->hbm, sizeof(BITMAP), (LPVOID)&bmp);
 
 	    textRect = r;
-	    if (infoPtr->bUnicode)
-              DrawTextW (hdc, phdi->pszText, -1,
-	   	  &textRect, DT_LEFT|DT_VCENTER|DT_SINGLELINE|DT_CALCRECT);
-	    else
-              DrawTextA (hdc, (LPCSTR)phdi->pszText, -1,
-	   	  &textRect, DT_LEFT|DT_VCENTER|DT_SINGLELINE|DT_CALCRECT);
+	     /* phdi->pszText is every time stored as Unicode */
+	    DrawTextW (hdc, phdi->pszText, -1,
+	               &textRect, DT_LEFT|DT_VCENTER|DT_SINGLELINE|DT_CALCRECT);
 	    tx = textRect.right - textRect.left;
 	    ry = r.bottom - r.top;
 	    rx = r.right - r.left;
@@ -315,14 +312,10 @@
             r.left += 3 ;
 	    r.right -= 3;
 	    SetTextColor (hdc, (bHotTrack) ? COLOR_HIGHLIGHT : COLOR_BTNTEXT);
-	    if (infoPtr->bUnicode)
-              DrawTextW (hdc, phdi->pszText, -1,
-	   	  &r, uTextJustify|DT_END_ELLIPSIS|DT_VCENTER|DT_SINGLELINE);
-	    else
-              DrawTextA (hdc, (LPCSTR)phdi->pszText, -1,
-	   	  &r, uTextJustify|DT_END_ELLIPSIS|DT_VCENTER|DT_SINGLELINE);
-            if (oldBkMode != TRANSPARENT)
-                SetBkMode(hdc, oldBkMode);
+	    DrawTextW (hdc, phdi->pszText, -1,
+	               &r, uTextJustify|DT_END_ELLIPSIS|DT_VCENTER|DT_SINGLELINE);
+	    if (oldBkMode != TRANSPARENT)
+	        SetBkMode(hdc, oldBkMode);
         }
     }/*Ownerdrawn*/
 
Index: programs/winefile/winefile.c
===================================================================
RCS file: /home/wine/wine/programs/winefile/winefile.c,v
retrieving revision 1.4
diff -u -r1.4 winefile.c
--- programs/winefile/winefile.c	12 Sep 2002 17:29:12 -0000	1.4
+++ programs/winefile/winefile.c	14 Oct 2002 22:22:40 -0000
@@ -2328,7 +2340,10 @@
 
 	get_path(entry, path);
 	lstrcpy(child->path, path);
-	SetWindowText(child->hwnd, path);
+
+	if (child->hwnd)	// only change window title, if the window already exists
+		SetWindowText(child->hwnd, path);
+
 	SetCurrentDirectory(path);
 }
 




More information about the wine-patches mailing list