Lookup DrawCaptionTemp () only once during startup

svn path=/trunk/; revision=33950
This commit is contained in:
Thomas Bluemel 2008-06-12 16:50:57 +00:00
parent 5d074bd015
commit cdbc0773a5
4 changed files with 28 additions and 37 deletions

View file

@ -21,8 +21,10 @@
#include <precomp.h> #include <precomp.h>
HINSTANCE hExplorerInstance; HINSTANCE hExplorerInstance;
HMODULE hUser32;
HANDLE hProcessHeap; HANDLE hProcessHeap;
HKEY hkExplorer = NULL; HKEY hkExplorer = NULL;
DRAWCAPTEMP DrawCapTemp = NULL;
/* undoc GUID */ /* undoc GUID */
DEFINE_GUID(CLSID_RebarBandSite, 0xECD4FC4D, 0x521C, 0x11D0, 0xB7, 0x92, 0x00, 0xA0, 0xC9, 0x03, 0x12, 0xE1); DEFINE_GUID(CLSID_RebarBandSite, 0xECD4FC4D, 0x521C, 0x11D0, 0xB7, 0x92, 0x00, 0xA0, 0xC9, 0x03, 0x12, 0xE1);
@ -289,6 +291,13 @@ _tWinMain(IN HINSTANCE hInstance,
hExplorerInstance = hInstance; hExplorerInstance = hInstance;
hProcessHeap = GetProcessHeap(); hProcessHeap = GetProcessHeap();
hUser32 = GetModuleHandle(TEXT("USER32.DLL"));
if (hUser32 != NULL)
{
DrawCapTemp = (DRAWCAPTEMP)GetProcAddress(hUser32,
PROC_NAME_DRAWCAPTIONTEMP);
}
InitCommonControls(); InitCommonControls();
OleInitialize(NULL); OleInitialize(NULL);

View file

@ -77,8 +77,10 @@ Win32DbgPrint(const char *filename, int line, const char *lpFormat, ...)
Win32DbgPrint(__FILE__, __LINE__, fmt, ##__VA_ARGS__); Win32DbgPrint(__FILE__, __LINE__, fmt, ##__VA_ARGS__);
extern HINSTANCE hExplorerInstance; extern HINSTANCE hExplorerInstance;
extern HMODULE hUser32;
extern HANDLE hProcessHeap; extern HANDLE hProcessHeap;
extern HKEY hkExplorer; extern HKEY hkExplorer;
extern DRAWCAPTEMP DrawCapTemp;
/* /*
* dragdrop.c * dragdrop.c

View file

@ -1640,7 +1640,6 @@ TaskSwichWnd_HandleItemPaint(IN OUT PTASK_SWITCH_WND This,
{ {
HFONT hCaptionFont, hBoldCaptionFont; HFONT hCaptionFont, hBoldCaptionFont;
LRESULT Ret = CDRF_DODEFAULT; LRESULT Ret = CDRF_DODEFAULT;
HMODULE hUser32;
PTASK_GROUP TaskGroup; PTASK_GROUP TaskGroup;
PTASK_ITEM TaskItem; PTASK_ITEM TaskItem;
@ -1701,25 +1700,16 @@ TaskSwichWnd_HandleItemPaint(IN OUT PTASK_SWITCH_WND This,
uidctFlags |= DC_ACTIVE; uidctFlags |= DC_ACTIVE;
} }
hUser32 = GetModuleHandle(TEXT("USER32.DLL")); if (DrawCapTemp != NULL)
if (hUser32 != NULL)
{ {
DRAWCAPTEMP DrawCapTemp; /* Draw the button content */
TaskItem->DisplayTooltip = !DrawCapTemp(TaskItem->hWnd,
/* DrawCaptionTemp */ nmtbcd->nmcd.hdc,
DrawCapTemp = (DRAWCAPTEMP)GetProcAddress(hUser32, &nmtbcd->nmcd.rc,
PROC_NAME_DRAWCAPTIONTEMP); hCaptionFont,
if (DrawCapTemp != NULL) NULL,
{ NULL,
/* Draw the button content */ uidctFlags);
TaskItem->DisplayTooltip = !DrawCapTemp(TaskItem->hWnd,
nmtbcd->nmcd.hdc,
&nmtbcd->nmcd.rc,
hCaptionFont,
NULL,
NULL,
uidctFlags);
}
} }
return CDRF_SKIPDEFAULT; return CDRF_SKIPDEFAULT;

View file

@ -1223,7 +1223,6 @@ ITrayWindowImpl_CreateStartButtonBitmap(IN OUT ITrayWindowImpl *This)
BOOL Ret; BOOL Ret;
UINT Flags; UINT Flags;
RECT rcButton; RECT rcButton;
HMODULE hUser32;
/* NOTE: This is the backwards compatibility code that is used if the /* NOTE: This is the backwards compatibility code that is used if the
Common Controls Version 6.0 are not available! */ Common Controls Version 6.0 are not available! */
@ -1294,24 +1293,15 @@ ITrayWindowImpl_CreateStartButtonBitmap(IN OUT ITrayWindowImpl *This)
if (hIconStart != NULL) if (hIconStart != NULL)
Flags |= DC_ICON; Flags |= DC_ICON;
hUser32 = GetModuleHandle(TEXT("USER32.DLL")); if (DrawCapTemp != NULL)
if (hUser32 != NULL)
{ {
DRAWCAPTEMP DrawCapTemp; Ret = DrawCapTemp(NULL,
hDC,
/* DrawCaptionTemp */ &rcButton,
DrawCapTemp = (DRAWCAPTEMP)GetProcAddress(hUser32, This->hStartBtnFont,
PROC_NAME_DRAWCAPTIONTEMP); hIconStart,
if (DrawCapTemp != NULL) szStartCaption,
{ Flags);
Ret = DrawCapTemp(NULL,
hDC,
&rcButton,
This->hStartBtnFont,
hIconStart,
szStartCaption,
Flags);
}
} }
SelectObject(hDC, SelectObject(hDC,