From 8cc084b70b8b075a7a5e6fb7306c0ca057e68a75 Mon Sep 17 00:00:00 2001 From: hobbs2 Date: Sat, 23 Feb 2008 22:16:53 +0000 Subject: * generic/tkTreeTheme.c (DllMain): get module at dll load time to avoid GetModuleHandleEx call. --- ChangeLog | 5 +++++ generic/tkTreeTheme.c | 20 +++++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index cb4a73f..7395694 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-02-23 Jeff Hobbs + + * generic/tkTreeTheme.c (DllMain): get module at dll load time to + avoid GetModuleHandleEx call. + 2008-02-22 Jeff Hobbs * demos/demo.tcl, doc/What's New in TkTreeCtrl.html: diff --git a/generic/tkTreeTheme.c b/generic/tkTreeTheme.c index ca3228d..5e427fa 100644 --- a/generic/tkTreeTheme.c +++ b/generic/tkTreeTheme.c @@ -5,7 +5,7 @@ * * Copyright (c) 2006-2008 Tim Baker * - * RCS: @(#) $Id: tkTreeTheme.c,v 1.23 2008/02/09 03:46:02 treectrl Exp $ + * RCS: @(#) $Id: tkTreeTheme.c,v 1.24 2008/02/23 22:16:53 hobbs2 Exp $ */ #if defined(WIN32) || defined(_WIN32) @@ -156,10 +156,15 @@ GetActCtxProcs(void) return NULL; } +static HMODULE thisModule = NULL; + /* Return the HMODULE for this treectrl.dll. */ static HMODULE GetMyHandle(void) { +#if 1 + return thisModule; +#else HMODULE hModule = NULL; /* FIXME: Only >=NT so I shouldn't link to it? But I already linked to @@ -169,6 +174,19 @@ GetMyHandle(void) (LPCTSTR)&appThemeData, &hModule); return hModule; +#endif +} + +BOOL WINAPI +DllMain(hInst, reason, reserved) + HINSTANCE hInst; /* Library instance handle. */ + DWORD reason; /* Reason this function is being called. */ + LPVOID reserved; /* Not used. */ +{ + if (reason == DLL_PROCESS_ATTACH) { + thisModule = (HMODULE) hInst; + } + return TRUE; } static HANDLE -- cgit v0.12