[ros-diffs] [weiden] 33950: Lookup DrawCaptionTemp () only once during startup

weiden at svn.reactos.org weiden at svn.reactos.org
Thu Jun 12 18:50:58 CEST 2008


Author: weiden
Date: Thu Jun 12 11:50:57 2008
New Revision: 33950

URL: http://svn.reactos.org/svn/reactos?rev=33950&view=rev
Log:
Lookup DrawCaptionTemp () only once during startup

Modified:
    trunk/reactos/base/shell/explorer-new/explorer.c
    trunk/reactos/base/shell/explorer-new/precomp.h
    trunk/reactos/base/shell/explorer-new/taskswnd.c
    trunk/reactos/base/shell/explorer-new/traywnd.c

Modified: trunk/reactos/base/shell/explorer-new/explorer.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer-new/explorer.c?rev=33950&r1=33949&r2=33950&view=diff
==============================================================================
--- trunk/reactos/base/shell/explorer-new/explorer.c [iso-8859-1] (original)
+++ trunk/reactos/base/shell/explorer-new/explorer.c [iso-8859-1] Thu Jun 12 11:50:57 2008
@@ -21,8 +21,10 @@
 #include <precomp.h>
 
 HINSTANCE hExplorerInstance;
+HMODULE hUser32;
 HANDLE hProcessHeap;
 HKEY hkExplorer = NULL;
+DRAWCAPTEMP DrawCapTemp = NULL;
 
 /* undoc GUID */
 DEFINE_GUID(CLSID_RebarBandSite, 0xECD4FC4D, 0x521C, 0x11D0, 0xB7, 0x92, 0x00, 0xA0, 0xC9, 0x03, 0x12, 0xE1);
@@ -289,6 +291,13 @@
     hExplorerInstance = hInstance;
     hProcessHeap = GetProcessHeap();
 
+    hUser32 = GetModuleHandle(TEXT("USER32.DLL"));
+    if (hUser32 != NULL)
+    {
+        DrawCapTemp = (DRAWCAPTEMP)GetProcAddress(hUser32,
+                                                  PROC_NAME_DRAWCAPTIONTEMP);
+    }
+
     InitCommonControls();
     OleInitialize(NULL);
 

Modified: trunk/reactos/base/shell/explorer-new/precomp.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer-new/precomp.h?rev=33950&r1=33949&r2=33950&view=diff
==============================================================================
--- trunk/reactos/base/shell/explorer-new/precomp.h [iso-8859-1] (original)
+++ trunk/reactos/base/shell/explorer-new/precomp.h [iso-8859-1] Thu Jun 12 11:50:57 2008
@@ -77,8 +77,10 @@
     Win32DbgPrint(__FILE__, __LINE__, fmt, ##__VA_ARGS__);
 
 extern HINSTANCE hExplorerInstance;
+extern HMODULE hUser32;
 extern HANDLE hProcessHeap;
 extern HKEY hkExplorer;
+extern DRAWCAPTEMP DrawCapTemp;
 
 /*
  * dragdrop.c

Modified: trunk/reactos/base/shell/explorer-new/taskswnd.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer-new/taskswnd.c?rev=33950&r1=33949&r2=33950&view=diff
==============================================================================
--- trunk/reactos/base/shell/explorer-new/taskswnd.c [iso-8859-1] (original)
+++ trunk/reactos/base/shell/explorer-new/taskswnd.c [iso-8859-1] Thu Jun 12 11:50:57 2008
@@ -1640,7 +1640,6 @@
 {
     HFONT hCaptionFont, hBoldCaptionFont;
     LRESULT Ret = CDRF_DODEFAULT;
-    HMODULE hUser32;
     PTASK_GROUP TaskGroup;
     PTASK_ITEM TaskItem;
 
@@ -1701,25 +1700,16 @@
                     uidctFlags |= DC_ACTIVE;
             }
 
-            hUser32 = GetModuleHandle(TEXT("USER32.DLL"));
-            if (hUser32 != NULL)
-            {
-                DRAWCAPTEMP DrawCapTemp;
-
-                /* DrawCaptionTemp */
-                DrawCapTemp = (DRAWCAPTEMP)GetProcAddress(hUser32,
-                                                          PROC_NAME_DRAWCAPTIONTEMP);
-                if (DrawCapTemp != NULL)
-                {
-                    /* Draw the button content */
-                    TaskItem->DisplayTooltip = !DrawCapTemp(TaskItem->hWnd,
-                                                            nmtbcd->nmcd.hdc,
-                                                            &nmtbcd->nmcd.rc,
-                                                            hCaptionFont,
-                                                            NULL,
-                                                            NULL,
-                                                            uidctFlags);
-                }
+            if (DrawCapTemp != NULL)
+            {
+                /* Draw the button content */
+                TaskItem->DisplayTooltip = !DrawCapTemp(TaskItem->hWnd,
+                                                        nmtbcd->nmcd.hdc,
+                                                        &nmtbcd->nmcd.rc,
+                                                        hCaptionFont,
+                                                        NULL,
+                                                        NULL,
+                                                        uidctFlags);
             }
 
             return CDRF_SKIPDEFAULT;

Modified: trunk/reactos/base/shell/explorer-new/traywnd.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer-new/traywnd.c?rev=33950&r1=33949&r2=33950&view=diff
==============================================================================
--- trunk/reactos/base/shell/explorer-new/traywnd.c [iso-8859-1] (original)
+++ trunk/reactos/base/shell/explorer-new/traywnd.c [iso-8859-1] Thu Jun 12 11:50:57 2008
@@ -1223,7 +1223,6 @@
     BOOL Ret;
     UINT Flags;
     RECT rcButton;
-    HMODULE hUser32;
 
     /* NOTE: This is the backwards compatibility code that is used if the
              Common Controls Version 6.0 are not available! */
@@ -1294,24 +1293,15 @@
     if (hIconStart != NULL)
         Flags |= DC_ICON;
 
-    hUser32 = GetModuleHandle(TEXT("USER32.DLL"));
-    if (hUser32 != NULL)
-    {
-        DRAWCAPTEMP DrawCapTemp;
-
-        /* DrawCaptionTemp */
-        DrawCapTemp = (DRAWCAPTEMP)GetProcAddress(hUser32,
-                                                  PROC_NAME_DRAWCAPTIONTEMP);
-        if (DrawCapTemp != NULL)
-        {
-            Ret = DrawCapTemp(NULL,
-                              hDC,
-                              &rcButton,
-                              This->hStartBtnFont,
-                              hIconStart,
-                              szStartCaption,
-                              Flags);
-        }
+    if (DrawCapTemp != NULL)
+    {
+        Ret = DrawCapTemp(NULL,
+                          hDC,
+                          &rcButton,
+                          This->hStartBtnFont,
+                          hIconStart,
+                          szStartCaption,
+                          Flags);
     }
 
     SelectObject(hDC,



More information about the Ros-diffs mailing list