2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
15 * DEFINITIONS ________________________________________________________________
19 #if defined(UNICODE) && !defined(_UNICODE)
22 #if defined(_UNICODE) && !defined(UNICODE)
33 WCHAR achString[1]; // contains {cchString} members
34 } STRINGTEMPLATE, *LPSTRINGTEMPLATE;
35 typedef const STRINGTEMPLATE *LPCSTRINGTEMPLATE;
38 * PROTOTYPES _________________________________________________________________
42 #include <WINNT/tal_string.h>
43 #include <WINNT/tal_dialog.h>
44 #include <WINNT/tal_alloc.h>
47 #define EXPORTED __declspec(dllexport)
51 #define REALLOC(_a,_c,_r,_i) TaLocaleReallocFunction ((LPVOID*)&_a,sizeof(*_a),&_c,_r,_i)
52 extern EXPORTED BOOL TaLocaleReallocFunction (LPVOID *ppTarget, size_t cbElement, size_t *pcTarget, size_t cReq, size_t cInc);
57 *** TaLocale_SpecifyModule
59 * Adds the given module handle to TaLocale's known list of possible sources
60 * for localized resource data. By default, the list is initialized with
61 * the current executable's module handle; if resources are to be extracted
62 * from other .DLLs using the functions in the TaLocale library, this routine
63 * should be called first to notify TaLocale about each .DLL.
67 #define MODULE_PRIORITY_HIGHEST 1 // Search this module first
68 #define MODULE_PRIORITY_BOOSTED 40 // Search this module fairly early
69 #define MODULE_PRIORITY_NORMAL 50 // Search this module any time
70 #define MODULE_PRIORITY_LOWEST 100 // Search this module last
71 #define MODULE_PRIORITY_REMOVE 0 // Never search this module again
73 extern EXPORTED void TaLocale_SpecifyModule (HINSTANCE hInstance = NULL, WORD wSearchPriority = MODULE_PRIORITY_NORMAL);
77 *** TaLocale_LoadCorrespondingModule
79 * This routine looks for a .DLL named after the specified module, but
80 * with a suffix reflecting the current locale--it loads that library
81 * and adds it to the active-resources chain (via TaLocale_SpecifyModule()).
82 * The .DLL should ideally live in the same directory as the specified
83 * module; if not, it should at least be on the path.
87 extern EXPORTED HINSTANCE TaLocale_LoadCorrespondingModule (HINSTANCE hInstance = NULL, WORD wSearchPriority = MODULE_PRIORITY_BOOSTED);
89 extern EXPORTED HINSTANCE TaLocale_LoadCorrespondingModuleByName (HINSTANCE hInstance, LPTSTR pszFilename, WORD wSearchPriority = MODULE_PRIORITY_BOOSTED);
93 *** TaLocale_EnumModule
95 * Enables enumeration of each of the product modules which will be seached
96 * by TaLocale for resources. Use TaLocale_SpecifyModule to modify this list.
97 * Modules will be returned in priority order, with the highest-priority
98 * modules being searched first.
102 extern EXPORTED BOOL TaLocale_EnumModule (size_t iModule, HINSTANCE *phInstance = NULL, WORD *pwSearchPriority = NULL);
106 *** TaLocale_GetLanguage
107 *** TaLocale_SetLanguage
109 * Allows specification of a default language for resources extracted by
110 * the functions exported by tal_string.h and tal_dialog.h. When a particular
111 * string or dialog resource is required, the resource which matches this
112 * specified language will be retrieved--if no localized resource is available,
113 * the default resource will instead be used.
117 extern EXPORTED LANGID TaLocale_GetLanguage (void);
118 extern EXPORTED void TaLocale_SetLanguage (LANGID lang);
122 *** TaLocale_GetLanguageOverride
123 *** TaLocale_SetLanguageOverride
124 *** TaLocale_RemoveLanguageOverride
126 * Allows specification of a persistent default language for resources
127 * extracted by the functions exported by tal_string.h and tal_dialog.h.
128 * If a language override (which is really just a registry entry) exists,
129 * all TaLocale-based applications will default to that locale when first
134 extern EXPORTED LANGID TaLocale_GetLanguageOverride (void);
135 extern EXPORTED void TaLocale_SetLanguageOverride (LANGID lang);
136 extern EXPORTED void TaLocale_RemoveLanguageOverride (void);
140 *** TaLocale_GetResource
142 * Returns a pointer an in-memory image of a language-specific resource.
143 * The resource is found by searching all specified module handles
144 * (as determined automatically, or as specified by previous calls to
145 * TaLocale_SpecifyModule()) for an equivalent resource identifier matching
146 * the requested resource type and localized into the requested language.
147 * In the event that a matching localized resource cannot be found, the
148 * search is repeated using LANG_USER_DEFAULT.
150 * The pointer returned should be treated as read-only, and should not be freed.
154 extern EXPORTED LPCVOID TaLocale_GetResource (LPCTSTR pszType, LPCTSTR pszRes, LANGID lang = LANG_USER_DEFAULT, HINSTANCE *phInstFound = NULL);
158 *** TaLocale_GetStringResource
159 *** TaLocale_GetDialogResource
161 * Convenience wrappers around TaLocale_GetResource for obtaining resources
162 * of a particular type by numeric identifier; these routines specify the
163 * default language (from TaLocale_SetLanguage()) when calling
164 * TaLocale_GetResource().
168 extern EXPORTED LPCSTRINGTEMPLATE TaLocale_GetStringResource (int ids, HINSTANCE *phInstFound = NULL);
169 extern EXPORTED LPCDLGTEMPLATE TaLocale_GetDialogResource (int idd, HINSTANCE *phInstFound = NULL);
173 *** TaLocale_LoadMenu
174 *** TaLocale_LoadImage
175 *** TaLocale_LoadIcon
176 *** TaLocale_LoadAccelerators
178 * Replacements for Win32 functions. By using these functions instead, the
179 * caller can load the appropriate resources regardless of the module in
180 * which they reside, or the language which is required.
184 extern EXPORTED HMENU TaLocale_LoadMenu (int idm);
185 extern EXPORTED HANDLE TaLocale_LoadImage (int idi, UINT imageType, int cx, int cy, UINT imageFlags);
186 extern EXPORTED HICON TaLocale_LoadIcon (int idi);
187 extern EXPORTED HACCEL TaLocale_LoadAccelerators (int ida);