1
+ /* Visual C++ 6 does not have support for the uxtheme library, nor
2
+ * is MUSHclient willing to drop support for pre-XP platforms.
3
+ * Thus, we need an 'optional' alternative to the uxtheme.lib
4
+ * library.
5
+ *
6
+ * Sadly, stdafx.h includes a whole lot of MFC libraries,
7
+ * which include uxtheme.h on their own, yet do not seem to use it.
8
+ *
9
+ * Thus, I cannot (easily) create dynamically linked functions to
10
+ * interface with uxtheme.dll as they are already defined, yet using
11
+ * the already defined uxtheme.h functions requires linking against
12
+ * uxtheme.lib. -JW
13
+ */
14
+
15
+
16
+ #ifndef __THEMEGLUE_H__
17
+ #define __THEMEGLUE_H__
18
+
19
+ #ifdef __cplusplus
20
+ extern "C" {
21
+ #endif
22
+
23
+ #include <windows.h>
24
+
25
+ HMODULE HModUXT = NULL ;
26
+
27
+ #define THEMEGLUE_FUNC (FuncStr , params , result , FuncName , formal_params ) \
28
+ result FuncName formal_params \
29
+ { \
30
+ /* Gotta load UxTheme.dll to find the function we want. */ \
31
+ if (HModUXT == NULL) \
32
+ HModUXT = LoadLibrary("UxTheme.dll"); \
33
+ \
34
+ if (HModUXT != NULL) \
35
+ { \
36
+ typedef result (WINAPI *FuncPtr) formal_params ; \
37
+ FuncPtr FuncCall = (FuncPtr) GetProcAddress(HModUXT, FuncStr); \
38
+ if (FuncCall != NULL) \
39
+ return FuncCall params ; \
40
+ } \
41
+ /* No real failure possible, all is optional. */ \
42
+ return S_OK ; \
43
+ }
44
+
45
+
46
+ /* THEMEGLUE_FUNC Format is: EntryPointString, SuppliedParameters, ResultType, FunctionName, FormalParameters */
47
+
48
+ THEMEGLUE_FUNC ("EnableThemeDialogTexture" , (hwnd , dwFlags ), HRESULT , ThemeGlue_EnableThemeDialogTexture , (HWND hwnd , DWORD dwFlags ))
49
+
50
+
51
+ /* 2010-09-26: Yes, all this work for a single function. =)
52
+ * But we might need more in the future, so I made it relatively easy to expand upon.
53
+ * TODO: support for static linking against uxtheme.lib, but ideally we refactor
54
+ * stdafx.h a bit and get rid of that include alltogether.
55
+ * -JW
56
+ */
57
+
58
+
59
+ #ifndef _UXTHEME_H_
60
+ /* We need some of these with EnableThemeDialogTexture, make sure we have them. */
61
+ #define ETDT_DISABLE 0x00000001
62
+ #define ETDT_ENABLE 0x00000002
63
+ #define ETDT_USETABTEXTURE 0x00000004
64
+ #define ETDT_ENABLETAB (ETDT_ENABLE | ETDT_USETABTEXTURE)
65
+ #endif
66
+
67
+ #ifdef __cplusplus
68
+ } // extern "C"
69
+ #endif
70
+
71
+ #endif
0 commit comments