summaryrefslogtreecommitdiffstats
path: root/win/tkWinX.c
diff options
context:
space:
mode:
authorhobbs <hobbs>2002-12-08 00:46:51 (GMT)
committerhobbs <hobbs>2002-12-08 00:46:51 (GMT)
commit9ba6b47ef626dc8248e5fcd5a420d332baeaae53 (patch)
tree0980b63dd1bf1aabca841a318efcd6eaf6102981 /win/tkWinX.c
parentdf50e6eb7fcee1b7b60c7dc9c0d1968124197b9e (diff)
downloadtk-9ba6b47ef626dc8248e5fcd5a420d332baeaae53.zip
tk-9ba6b47ef626dc8248e5fcd5a420d332baeaae53.tar.gz
tk-9ba6b47ef626dc8248e5fcd5a420d332baeaae53.tar.bz2
* generic/tkInt.decls: add TkWinSetHINSTANCE decl
* generic/tkIntPlatDecls.h: regen * generic/tkStubInit.c: regen * win/tkWinInit.c (TkpInit): While init and cleanup aren't correct * win/tkWinX.c (TkWinXInit): in DllMain, we had to specify the * win/tkWin32Dll.c (DllMain): true HINSTANCE or the resources of a dynamic Tk weren't being loaded correctly. Created a new function TkWinSetHINSTANCE for this purpose.
Diffstat (limited to 'win/tkWinX.c')
-rw-r--r--win/tkWinX.c33
1 files changed, 29 insertions, 4 deletions
diff --git a/win/tkWinX.c b/win/tkWinX.c
index f97db04..ae21e4b 100644
--- a/win/tkWinX.c
+++ b/win/tkWinX.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkWinX.c,v 1.24 2002/12/06 23:29:37 hobbs Exp $
+ * RCS: @(#) $Id: tkWinX.c,v 1.25 2002/12/08 00:46:51 hobbs Exp $
*/
#include "tkWinInt.h"
@@ -76,7 +76,7 @@ TkWinProcs *tkWinProcs;
*/
static char winScreenName[] = ":0"; /* Default name of windows display. */
-static HINSTANCE tkInstance; /* Application instance handle. */
+static HINSTANCE tkInstance = NULL; /* Application instance handle. */
static int childClassInitialized; /* Registered child class? */
static WNDCLASS childClass; /* Window class for child windows. */
static int tkPlatformId = 0; /* version of Windows platform */
@@ -171,12 +171,39 @@ TkGetServerInfo(interp, tkwin)
HINSTANCE
Tk_GetHINSTANCE()
{
+ if (tkInstance == NULL) {
+ tkInstance = GetModuleHandle(NULL);
+ }
return tkInstance;
}
/*
*----------------------------------------------------------------------
*
+ * TkWinSetHINSTANCE --
+ *
+ * Sets the global instance handle used by the Tk library.
+ * This should be called by DllMain.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkWinSetHINSTANCE(hInstance)
+ HINSTANCE hInstance;
+{
+ tkInstance = hInstance;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
* TkWinXInit --
*
* Initialize Xlib emulation layer.
@@ -214,8 +241,6 @@ TkWinXInit(hInstance)
tkWinProcs = &asciiProcs;
}
- tkInstance = hInstance;
-
/*
* When threads are enabled, we cannot use CLASSDC because
* threads will then write into the same device context.