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>
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 @@ _tWinMain(IN HINSTANCE hInstance,
hExplorerInstance = hInstance;
hProcessHeap = GetProcessHeap();
hUser32 = GetModuleHandle(TEXT("USER32.DLL"));
if (hUser32 != NULL)
{
DrawCapTemp = (DRAWCAPTEMP)GetProcAddress(hUser32,
PROC_NAME_DRAWCAPTIONTEMP);
}
InitCommonControls();
OleInitialize(NULL);

View file

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

View file

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

View file

@ -1223,7 +1223,6 @@ ITrayWindowImpl_CreateStartButtonBitmap(IN OUT ITrayWindowImpl *This)
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 @@ ITrayWindowImpl_CreateStartButtonBitmap(IN OUT ITrayWindowImpl *This)
if (hIconStart != NULL)
Flags |= DC_ICON;
hUser32 = GetModuleHandle(TEXT("USER32.DLL"));
if (hUser32 != NULL)
if (DrawCapTemp != NULL)
{
DRAWCAPTEMP DrawCapTemp;
/* DrawCaptionTemp */
DrawCapTemp = (DRAWCAPTEMP)GetProcAddress(hUser32,
PROC_NAME_DRAWCAPTIONTEMP);
if (DrawCapTemp != NULL)
{
Ret = DrawCapTemp(NULL,
hDC,
&rcButton,
This->hStartBtnFont,
hIconStart,
szStartCaption,
Flags);
}
Ret = DrawCapTemp(NULL,
hDC,
&rcButton,
This->hStartBtnFont,
hIconStart,
szStartCaption,
Flags);
}
SelectObject(hDC,