wordpad: Use smaller cbSize for REBARBANDINFOW for compatibility.

Dylan Smith dylan.ah.smith at gmail.com
Fri Aug 14 21:23:21 CDT 2009


The cbSize field for the REBARBANDINFOW structure was previously set to
the sizeof(REBARBANDINFOW), however, new fields were added to this
structure for newer version of windows.  Testing in Windows XP (or with
comctl32.dll from Windows XP) I found this larger size was rejected
causing the rebar to not be displayed in wordpad.

Since the new fields are not used by wordpad, it makes sense to use the
smaller acceptable size for cbSize for compatibility.
---
 programs/wordpad/print.c   |    4 ++--
 programs/wordpad/wordpad.c |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
-------------- next part --------------
diff --git a/programs/wordpad/print.c b/programs/wordpad/print.c
index a62f955..0a1343f 100644
--- a/programs/wordpad/print.c
+++ b/programs/wordpad/print.c
@@ -97,7 +97,7 @@ static void AddTextButton(HWND hRebarWnd, UINT string, UINT command, UINT id)
                             WS_VISIBLE | WS_CHILD, 5, 5, 100, 15,
                             hRebarWnd, ULongToHandle(command), hInstance, NULL);
 
-    rb.cbSize = sizeof(rb);
+    rb.cbSize = REBARBANDINFOW_V6_SIZE;
     rb.fMask = RBBIM_SIZE | RBBIM_CHILDSIZE | RBBIM_STYLE | RBBIM_CHILD | RBBIM_IDEALSIZE | RBBIM_ID;
     rb.fStyle = RBBS_NOGRIPPER | RBBS_VARIABLEHEIGHT;
     rb.hwndChild = hButton;
@@ -448,7 +448,7 @@ static void preview_bar_show(HWND hMainWnd, BOOL show)
                                 WS_VISIBLE | WS_CHILD, 0, 0, 0, 0,
                                 hReBar, NULL, NULL, NULL);
 
-        rb.cbSize = sizeof(rb);
+        rb.cbSize = REBARBANDINFOW_V6_SIZE;
         rb.fMask = RBBIM_SIZE | RBBIM_CHILDSIZE | RBBIM_STYLE | RBBIM_CHILD | RBBIM_IDEALSIZE | RBBIM_ID;
         rb.fStyle = RBBS_NOGRIPPER | RBBS_VARIABLEHEIGHT;
         rb.hwndChild = hStatic;
diff --git a/programs/wordpad/wordpad.c b/programs/wordpad/wordpad.c
index 80a6a07..e4e9ae0 100644
--- a/programs/wordpad/wordpad.c
+++ b/programs/wordpad/wordpad.c
@@ -644,7 +644,7 @@ static void set_toolbar_state(int bandId, BOOL show)
         REBARBANDINFOW rbbinfo;
         int index = SendMessageW(hwndReBar, RB_IDTOINDEX, BANDID_FONTLIST, 0);
 
-        rbbinfo.cbSize = sizeof(rbbinfo);
+        rbbinfo.cbSize = REBARBANDINFOW_V6_SIZE;
         rbbinfo.fMask = RBBIM_STYLE;
 
         SendMessageW(hwndReBar, RB_GETBANDINFO, index, (LPARAM)&rbbinfo);
@@ -1795,7 +1795,7 @@ static LRESULT OnCreate( HWND hWnd )
 
     SendMessageW(hToolBarWnd, TB_AUTOSIZE, 0, 0);
 
-    rbb.cbSize = sizeof(rbb);
+    rbb.cbSize = REBARBANDINFOW_V6_SIZE;
     rbb.fMask = RBBIM_SIZE | RBBIM_CHILDSIZE | RBBIM_CHILD | RBBIM_STYLE | RBBIM_ID;
     rbb.fStyle = RBBS_CHILDEDGE | RBBS_BREAK | RBBS_NOGRIPPER;
     rbb.cx = 0;


More information about the wine-patches mailing list