summaryrefslogtreecommitdiffstats
path: root/win/tkWinX.c
diff options
context:
space:
mode:
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.