[PATCH 04/45] [WinHelp]: simplify the Window creation code

Eric Pouech eric.pouech at orange.fr
Sun Mar 23 04:17:19 CDT 2008




A+
---

 programs/winhelp/winhelp.c |   22 +++++++++-------------
 1 files changed, 9 insertions(+), 13 deletions(-)


diff --git a/programs/winhelp/winhelp.c b/programs/winhelp/winhelp.c
index 2c42f48..adc4e7a 100644
--- a/programs/winhelp/winhelp.c
+++ b/programs/winhelp/winhelp.c
@@ -617,6 +617,15 @@ BOOL WINHELP_CreateHelpWindow(HLPFILE_PAGE* page, HLPFILE_WINDOWINFO* wi,
                         wi->origin.x, wi->origin.y, wi->size.cx, wi->size.cy,
                         NULL, bPrimary ? LoadMenu(Globals.hInstance, MAKEINTRESOURCE(MAIN_MENU)) : 0,
                         Globals.hInstance, win);
+    /* Create button box and text Window */
+    if (!bPopup)
+        CreateWindow(BUTTON_BOX_WIN_CLASS_NAME, "", WS_CHILD | WS_VISIBLE,
+                     0, 0, 0, 0, hWnd, (HMENU)CTL_ID_BUTTON, Globals.hInstance, win);
+
+    win->hTextWnd = CreateWindow(RICHEDIT_CLASS, NULL,
+                                 ES_MULTILINE | ES_READONLY | WS_CHILD | WS_HSCROLL | WS_VSCROLL | WS_VISIBLE,
+                                 0, 0, 0, 0, hWnd, (HMENU)CTL_ID_TEXT, Globals.hInstance, NULL);
+    WINHELP_LayoutMainWindow(win);
     if (bPopup) Globals.hPopupWnd = hWnd;
 
     ShowWindow(hWnd, nCmdShow);
@@ -688,19 +697,6 @@ static LRESULT CALLBACK WINHELP_MainWndProc(HWND hWnd, UINT msg, WPARAM wParam,
         win->hMainWnd = hWnd;
         break;
 
-    case WM_CREATE:
-        win = (WINHELP_WINDOW*) GetWindowLong(hWnd, 0);
-
-        /* Create button box and text Window */
-        if (!(GetWindowLong(hWnd, GWL_STYLE) & WS_POPUP))
-            CreateWindow(BUTTON_BOX_WIN_CLASS_NAME, "", WS_CHILD | WS_VISIBLE,
-                         0, 0, 0, 0, hWnd, (HMENU)CTL_ID_BUTTON, Globals.hInstance, win);
-
-        win->hTextWnd = CreateWindow(RICHEDIT_CLASS, NULL,
-                                     ES_MULTILINE | ES_READONLY | WS_CHILD | WS_HSCROLL | WS_VSCROLL | WS_VISIBLE,
-                                     0, 0, 0, 0, hWnd, (HMENU)CTL_ID_TEXT, Globals.hInstance, NULL);
-
-        /* Fall through */
     case WM_WINDOWPOSCHANGED:
         WINHELP_LayoutMainWindow((WINHELP_WINDOW*) GetWindowLong(hWnd, 0));
         break;





More information about the wine-patches mailing list