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 REALLOC(_a,_c,_r,_i) TaLocaleReallocFunction ((LPVOID*)&_a,sizeof(*_a),&_c,_r,_i)
48 extern BOOL TaLocaleReallocFunction (LPVOID *ppTarget, size_t cbElement, size_t *pcTarget, size_t cReq, size_t cInc);
53 *** TaLocale_SpecifyModule
55 * Adds the given module handle to TaLocale's known list of possible sources
56 * for localized resource data. By default, the list is initialized with
57 * the current executable's module handle; if resources are to be extracted
58 * from other .DLLs using the functions in the TaLocale library, this routine
59 * should be called first to notify TaLocale about each .DLL.
63 #define MODULE_PRIORITY_HIGHEST 1 // Search this module first
64 #define MODULE_PRIORITY_BOOSTED 40 // Search this module fairly early
65 #define MODULE_PRIORITY_NORMAL 50 // Search this module any time
66 #define MODULE_PRIORITY_LOWEST 100 // Search this module last
67 #define MODULE_PRIORITY_REMOVE 0 // Never search this module again
69 extern void TaLocale_SpecifyModule (HINSTANCE hInstance = NULL, WORD wSearchPriority = MODULE_PRIORITY_NORMAL);
73 *** TaLocale_LoadCorrespondingModule
75 * This routine looks for a .DLL named after the specified module, but
76 * with a suffix reflecting the current locale--it loads that library
77 * and adds it to the active-resources chain (via TaLocale_SpecifyModule()).
78 * The .DLL should ideally live in the same directory as the specified
79 * module; if not, it should at least be on the path.
83 extern HINSTANCE TaLocale_LoadCorrespondingModule (HINSTANCE hInstance = NULL, WORD wSearchPriority = MODULE_PRIORITY_BOOSTED);
85 extern HINSTANCE TaLocale_LoadCorrespondingModuleByName (HINSTANCE hInstance, LPTSTR pszFilename, WORD wSearchPriority = MODULE_PRIORITY_BOOSTED);
89 *** TaLocale_EnumModule
91 * Enables enumeration of each of the product modules which will be seached
92 * by TaLocale for resources. Use TaLocale_SpecifyModule to modify this list.
93 * Modules will be returned in priority order, with the highest-priority
94 * modules being searched first.
98 extern BOOL TaLocale_EnumModule (size_t iModule, HINSTANCE *phInstance = NULL, WORD *pwSearchPriority = NULL);
102 *** TaLocale_GetLanguage
103 *** TaLocale_SetLanguage
105 * Allows specification of a default language for resources extracted by
106 * the functions exported by tal_string.h and tal_dialog.h. When a particular
107 * string or dialog resource is required, the resource which matches this
108 * specified language will be retrieved--if no localized resource is available,
109 * the default resource will instead be used.
113 extern LANGID TaLocale_GetLanguage (void);
114 extern void TaLocale_SetLanguage (LANGID lang);
118 *** TaLocale_GetLanguageOverride
119 *** TaLocale_SetLanguageOverride
120 *** TaLocale_RemoveLanguageOverride
122 * Allows specification of a persistent default language for resources
123 * extracted by the functions exported by tal_string.h and tal_dialog.h.
124 * If a language override (which is really just a registry entry) exists,
125 * all TaLocale-based applications will default to that locale when first
130 extern LANGID TaLocale_GetLanguageOverride (void);
131 extern void TaLocale_SetLanguageOverride (LANGID lang);
132 extern void TaLocale_RemoveLanguageOverride (void);
136 *** TaLocale_GetResource
138 * Returns a pointer an in-memory image of a language-specific resource.
139 * The resource is found by searching all specified module handles
140 * (as determined automatically, or as specified by previous calls to
141 * TaLocale_SpecifyModule()) for an equivalent resource identifier matching
142 * the requested resource type and localized into the requested language.
143 * In the event that a matching localized resource cannot be found, the
144 * search is repeated using LANG_USER_DEFAULT.
146 * The pointer returned should be treated as read-only, and should not be freed.
150 extern LPCVOID TaLocale_GetResource (LPCTSTR pszType, LPCTSTR pszRes, LANGID lang = LANG_USER_DEFAULT, HINSTANCE *phInstFound = NULL);
154 *** TaLocale_GetStringResource
155 *** TaLocale_GetDialogResource
157 * Convenience wrappers around TaLocale_GetResource for obtaining resources
158 * of a particular type by numeric identifier; these routines specify the
159 * default language (from TaLocale_SetLanguage()) when calling
160 * TaLocale_GetResource().
164 extern LPCSTRINGTEMPLATE TaLocale_GetStringResource (int ids, HINSTANCE *phInstFound = NULL);
165 extern LPCDLGTEMPLATE TaLocale_GetDialogResource (int idd, HINSTANCE *phInstFound = NULL);
169 *** TaLocale_LoadMenu
170 *** TaLocale_LoadImage
171 *** TaLocale_LoadIcon
172 *** TaLocale_LoadAccelerators
174 * Replacements for Win32 functions. By using these functions instead, the
175 * caller can load the appropriate resources regardless of the module in
176 * which they reside, or the language which is required.
180 extern HMENU TaLocale_LoadMenu (int idm);
181 extern HANDLE TaLocale_LoadImage (int idi, UINT imageType, int cx, int cy, UINT imageFlags);
182 extern HICON TaLocale_LoadIcon (int idi);
183 extern HACCEL TaLocale_LoadAccelerators (int ida);