root/dwt/internal/win32/OS.d

Revision 322:2b8f40a1c515, 170.3 kB (checked in by Frank Benoit <benoit@tionex.de>, 2 months ago)

PrintWindow? only avaible starting WinXp? (5.1)

Line 
1 /*******************************************************************************
2  * Copyright (c) 2000, 2007 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  *     IBM Corporation - initial API and implementation
10  * Port to the D programming language:
11  *     Frank Benoit <benoit@tionex.de>
12  *******************************************************************************/
13 module dwt.internal.win32.OS;
14
15 public import dwt.internal.win32.WINTYPES;
16 version(TANGOSVN){
17     private import dwt.internal.win32.WINAPI;
18     alias dwt.internal.win32.WINAPI DWTWINAPI;
19     private import tango.sys.win32.UserGdi;
20     alias tango.sys.win32.UserGdi WINAPI;
21 }
22 else{
23     private import dwt.internal.win32.WINAPI;
24     alias dwt.internal.win32.WINAPI WINAPI;
25     alias dwt.internal.win32.WINAPI DWTWINAPI;
26 }
27
28 import dwt.internal.C;
29 import dwt.internal.Library;
30 import tango.sys.SharedLib : SharedLib;
31 import tango.sys.Common : SysError;
32 static import tango.stdc.stdlib;
33
34 import tango.stdc.string : memset, strlen;
35 import tango.stdc.stringz : toString16z;
36 import tango.text.convert.Utf : toString16;
37 static import tango.io.TempFile;
38 import tango.io.File;
39
40
41 import tango.util.log.Trace;
42 import tango.io.Console;
43 void trace(int line ){
44     //Trace.formatln( "OS {}", line );
45 }
46
47 // declare of Callback functions
48 extern (Windows)
49 {
50 alias int function() Function0;
51 alias int function(void*) Function1;
52 alias int function(void*, int) Function2;
53 alias int function(void*, int, int) Function3;
54 alias int function(void*, int, int, int) Function4;
55 alias int function(void*, int, int, int, int) Function5;
56 alias int function(void*, int, int, int, int, int) Function6;
57 alias int function(void*, int, int, int, int, int, int) Function7;
58 alias int function(void*, int, int, int, int, int, int, int) Function8;
59 alias int function(void*, int, int, int, int, int, int, int, int) Function9;
60 }
61
62
63 /*
64 Compile time versions
65     ANSI
66     WinCE
67
68     OS.IsUnicode
69     OS.IsWinCE
70
71     OS.IsHPC
72
73     OS.IsSP
74     OS.IsPPC
75     OS.IsWin95
76     OS.IsWinNT
77
78 */
79
80 public class LDWTRESULT {
81     public int value;
82     // initalize ONE and ZERO in static OS.this();
83     public static LDWTRESULT ONE;
84     public static LDWTRESULT ZERO;
85     public this (int value) { this.value = value; }
86 }
87
88
89 public class OS : C {
90
91     struct Symbol {
92         char[] name;
93         void** symbol;
94         int major;
95         int minor;
96     }
97     static void loadLib( Symbol[] symbols, char[] libname ){
98         if (auto lib = SharedLib.load(libname)) {
99             foreach( inout s; symbols ){
100                 if( OS.WIN32_VERSION >= OS.VERSION( s.major, s.minor )){
101                     *s.symbol = lib.getSymbol( s.name.ptr );
102                     if( s.symbol is null ){
103                         Trace.formatln( "{}: Symbol '{}' not found", libname, s.name );
104                     }
105                 }
106             }
107         } else {
108             Trace.formatln( "Could not load the library {}", libname );
109         }
110     }
111
112     public static HINSTANCE GetLibraryHandle(){
113         //PORTING_FIXME: GetLibraryHandle
114         // is the hInstance of the DLL or null, if not a DLL.
115         // At the moment DWT is statically linked but this needs to be fixed
116         return null;
117     }
118
119     // macro from winnt.h
120     public static int PRIMARYLANGID( int lgid ){
121         return lgid & 0x3FF;
122     }
123
124     public static int LVITEM_sizeof(){
125         return ( !OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION( 5, 1 )) ? LVITEM.sizeof : 40;
126     }
127     public static int MENUITEMINFO_sizeof(){
128         return ( !OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION( 5, 0 )) ? MENUITEMINFO.sizeof : 44;
129     }
130     public static int NMLVCUSTOMDRAW_sizeof(){
131         return ( !OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION( 5, 1 )) ? NMLVCUSTOMDRAW.sizeof : 60;
132     }
133     public static int NMLVDISPINFO_sizeof(){
134         return ( !OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION( 5, 1 )) ? NMLVDISPINFO.sizeof : 52;
135     }
136     public static int OPENFILENAME_sizeof(){
137         return ( !OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION( 5, 0 )) ? OPENFILENAME.sizeof : 76;
138     }
139     public static int TOOLINFO_sizeof(){
140         return ( !OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION( 5, 1 )) ? TOOLINFO.sizeof : 44;
141     }
142 //     private static int getNOTIFYICONDATAA_V2_SIZE (){
143 //         // hm, NOTIFYICONDATAA.dwInfoFlags.offsetof did not compile
144 //         return IsWinCE ? NOTIFYICONDATAA.sizeof : cast(int)(&(cast(NOTIFYICONDATAA*)null).dwInfoFlags) + int.sizeof;
145 //     }
146 //
147 //     private static int getNOTIFYICONDATAW_V2_SIZE (){
148 //         return IsWinCE ? NOTIFYICONDATAW.sizeof : cast(int)(&(cast(NOTIFYICONDATAW*)null).dwInfoFlags) + int.sizeof;
149 //     }
150 // kernel32 winxp/vista
151 public static extern(Windows) {
152 HANDLE function( ACTCTX* pActCtx ) CreateActCtx;
153 BOOL function( HACTCTX hActCtx, uint* lpCookie ) ActivateActCtx;
154 LANGID function() GetSystemDefaultUILanguage;
155 BOOL function(
156     LANGUAGEGROUP_ENUMPROC pLangGroupEnumProc, // callback function
157     DWORD dwFlags,                             // language groups
158     LONG_PTR  lParam                           // callback parameter
159 )EnumSystemLanguageGroupsA;
160 BOOL function(
161     LANGUAGEGROUP_ENUMPROC pLangGroupEnumProc, // callback function
162     DWORD dwFlags,                             // language groups
163     LONG_PTR  lParam                           // callback parameter
164 )EnumSystemLanguageGroupsW;
165 BOOL function(
166     LOCALE_ENUMPROC lpLocaleEnumProc, // callback function
167     DWORD dwFlags                     // locales
168 )EnumSystemLocalesA;
169 BOOL function(
170     LOCALE_ENUMPROC lpLocaleEnumProc, // callback function
171     DWORD dwFlags                     // locales
172 )EnumSystemLocalesW;
173 }
174
175     /*
176     * DWT Windows flags
177     */
178     public static BOOL IsWin32s;
179     public static BOOL IsWin95;
180     public static BOOL IsWinNT;
181
182     version(WinCE) {
183         public const static BOOL IsWinCE = true;
184         public static const BOOL IsHPC   = false; //todo
185     }
186     else {
187         public const static BOOL IsWinCE = false;
188         public static const BOOL IsHPC   = false;
189     }
190
191     public static const BOOL IsPPC = false;
192
193     // PORTING_FIXME, is it Windows WFSP?
194     public static const BOOL IsSP = false;
195
196     public static const BOOL IsDBLocale;
197
198     version(ANSI) {
199         public const BOOL IsUnicode = false;
200     }else{
201         public const BOOL IsUnicode = true;
202     }
203
204     public static const int WIN32_MAJOR, WIN32_MINOR, WIN32_VERSION;
205     public static const int COMCTL32_MAJOR, COMCTL32_MINOR, COMCTL32_VERSION;
206     public static const int SHELL32_MAJOR, SHELL32_MINOR, SHELL32_VERSION;
207
208     public static const char[] NO_MANIFEST = "dwt.internal.win32.OS.NO_MANIFEST";
209
210
211     /*
212     * Flags for Window API GetVersionEx()
213     */
214     public static const int VER_PLATFORM_WIN32s = 0;
215     public static const int VER_PLATFORM_WIN32_WINDOWS = 1;
216     public static const int VER_PLATFORM_WIN32_NT = 2;
217     public static const int VER_PLATFORM_WIN32_CE = 3;
218
219     /* Forward references */
220     public static const int HEAP_ZERO_MEMORY = 0x8;
221     public static const int ACTCTX_FLAG_RESOURCE_NAME_VALID    = 0x00000008;
222     public static const int ACTCTX_FLAG_SET_PROCESS_DEFAULT    = 0x00000010;
223     public static const int ACTCTX_FLAG_APPLICATION_NAME_VALID = 0x00000020;
224     public static const int ACTCTX_FLAG_OVERRIDEMANIFEST_VALID = 0x00000100;
225     public static const TCHAR* MANIFEST_RESOURCE_ID = cast(TCHAR*)1;
226     public static const int SM_DBCSENABLED = 0x2A;
227     public static const int SM_IMMENABLED = 0x52;
228     public static const int LANG_KOREAN = 0x12;
229     public static const int MAX_PATH = 260;
230
231 //     static this(){
232 //         NOTIFYICONDATAA_V2_SIZE = getNOTIFYICONDATAA_V2_SIZE ();
233 //         NOTIFYICONDATAW_V2_SIZE = getNOTIFYICONDATAW_V2_SIZE ();
234 //         NOTIFYICONDATA_V2_SIZE = IsUnicode ? getNOTIFYICONDATAW_V2_SIZE : getNOTIFYICONDATAA_V2_SIZE;
235 //         OSVERSIONINFO info;
236 //         IsWin32s = (info.dwPlatformId is VER_PLATFORM_WIN32s);
237 //         IsWin95 = (info.dwPlatformId is VER_PLATFORM_WIN32_WINDOWS);
238 //         IsWinNT = (info.dwPlatformId is VER_PLATFORM_WIN32_NT);
239 //         //IsSP_ = false;
240 //         //IsPPC_ = false;
241 //         //IsHPC = false;
242 //         IsDBLocale = false;
243 //         WIN32_MAJOR = info.dwMajorVersion;
244 //         WIN32_MINOR = info.dwMinorVersion;
245 //         WIN32_VERSION = VERSION (WIN32_MAJOR, WIN32_MINOR);
246 //         //IsUnicode = !IsWin32s && !IsWin95;
247 //         DLLVERSIONINFO dvi;
248 //         COMCTL32_MAJOR = dvi.dwMajorVersion;
249 //         COMCTL32_MINOR = dvi.dwMinorVersion;
250 //         COMCTL32_VERSION = VERSION (COMCTL32_MAJOR, COMCTL32_MINOR);
251 //         SHELL32_MAJOR = dvi.dwMajorVersion;
252 //         SHELL32_MINOR = dvi.dwMinorVersion;
253 //         SHELL32_VERSION = VERSION (SHELL32_MAJOR, SHELL32_MINOR);
254 //     }
255
256     /* Get the Windows version and the flags */
257     public static this() {
258         LDWTRESULT.ONE = new LDWTRESULT(1);
259         LDWTRESULT.ZERO = new LDWTRESULT(0);
260         /*
261         * Try the UNICODE version of GetVersionEx first
262         * and then the ANSI version.  The UNICODE version
263         * is present on all versions of Windows but is not
264         * implemented on Win95/98/ME.
265         *
266         * NOTE: The value of OSVERSIONINFO.sizeof cannot
267         * be static final because it relies on the Windows
268         * platform version to be initialized and IsUnicode
269         * has not been calculated.  It must be initialized
270         * here, after the platform is determined in order
271         * for the value to be correct.
272         */
273         OSVERSIONINFO info;
274         info.dwOSVersionInfoSize = OSVERSIONINFO.sizeof;
275         if(!OS.GetVersionEx(&info)){
276             MessageBoxA(null,
277                     _PCHAR!("DWT Unicode version applications can't run in a non-Unicode platform !"),
278                     _PCHAR!("Error"),
279                     MB_OK|MB_ICONERROR);
280             tango.stdc.stdlib.exit(-1);
281         }
282         //OSVERSIONINFO info = new OSVERSIONINFOW ();
283         //info.dwOSVersionInfoSize = OSVERSIONINFOW.sizeof;
284         //if (!OS.GetVersionExW ((OSVERSIONINFOW)info)) {
285         //    info = new OSVERSIONINFOA ();
286         //    info.dwOSVersionInfoSize = OSVERSIONINFOA.sizeof;
287         //    OS.GetVersionExA ((OSVERSIONINFOA)info);
288         //}
289         //OSVERSIONINFO.sizeof = info.dwOSVersionInfoSize;
290
291         IsWin32s = (info.dwPlatformId is VER_PLATFORM_WIN32s);
292         IsWin95 = (info.dwPlatformId is VER_PLATFORM_WIN32_WINDOWS);
293         IsWinNT = (info.dwPlatformId is VER_PLATFORM_WIN32_NT);
294         //PORTING_CHANGE: made by version
295         //IsWinCE = (info.dwPlatformId is VER_PLATFORM_WIN32_CE);
296         //PORTING_CHANGE: made by version
297         //IsSP  = IsSP();
298         //PORTING_CHANGE: made by version
299         //IsPPC = IsPPC();
300         version(WinCE) {
301             IsHPC = IsWinCE && !IsPPC && !IsSP;
302         }
303         WIN32_MAJOR = info.dwMajorVersion;
304         WIN32_MINOR = info.dwMinorVersion;
305         WIN32_VERSION = VERSION (WIN32_MAJOR, WIN32_MINOR);
306
307         if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (5, 0)) {
308             loadLib( Symbols_Kernel32, `Kernel32.dll` );
309         }
310
311         //PORTING_CHANGE: made by version
312         //IsUnicode = !IsWin32s && !IsWin95;
313
314         /* Load the manifest to force the XP Theme */
315         if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (5, 1)) {
316             //enableVisualStyles();
317         }
318
319         // when to load uxtheme
320         if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (5, 1)) {
321             loadLib( Symbols_UxTheme, `UxTheme.dll` );
322         }
323         if (OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (5, 1)) {
324             loadLib( Symbols_CoreImm, `Coreimm.dll` );
325         }
326         if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (5, 0)) {
327             loadLib( Symbols_User32, `User32.dll` );
328         }
329         if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (4, 0)) {
330             loadLib( Symbols_Imm32, `Imm32.dll` );
331         }
332
333         /* Make the process DPI aware for Windows Vista */
334         if (OS.WIN32_VERSION >= OS.VERSION (6, 0)) OS.SetProcessDPIAware ();
335
336         /* Get the DBCS flag */
337         BOOL dbcsEnabled = OS.GetSystemMetrics (SM_DBCSENABLED) !is 0;
338         BOOL immEnabled = OS.GetSystemMetrics (SM_IMMENABLED) !is 0;
339         IsDBLocale = dbcsEnabled || immEnabled;
340
341         /*
342         * Bug in Windows.  On Korean Windows XP when the Text
343         * Services Framework support for legacy applications
344         * is enabled, certain legacy calls segment fault.
345         * For example, when ImmSetCompositionWindow() is used
346         * to move the composition window outside of the client
347         * area, Windows crashes.  The fix is to disable legacy
348         * support.
349         *
350         * Note: The bug is fixed in Service Pack 2.
351         */
352         if (!OS.IsWinCE && OS.WIN32_VERSION is OS.VERSION (5, 1)) {
353             short langID = OS.GetSystemDefaultUILanguage ();
354             short primaryLang = OS.PRIMARYLANGID (langID);
355             if (primaryLang is LANG_KOREAN) {
356                 OSVERSIONINFOEX infoex;
357                 infoex.dwOSVersionInfoSize = OSVERSIONINFOEX.sizeof;
358                 GetVersionEx (cast(OSVERSIONINFO*) &infoex );
359                 if (infoex.wServicePackMajor < 2) {
360                     OS.ImmDisableTextFrameService (0);
361                 }
362             }
363         }
364
365         /* Get the COMCTL32.DLL version */
366         DLLVERSIONINFO dvi;
367         dvi.cbSize = DLLVERSIONINFO.sizeof;
368         dvi.dwMajorVersion = 4;
369         dvi.dwMinorVersion = 0;
370         //PORTING_CHANGE: comctl is loaded automatically
371         //TCHAR lpLibFileName = new TCHAR (0, "comctl32.dll", true); //$NON-NLS-1$
372         //int /*long*/ hModule = OS.LoadLibrary (lpLibFileName);
373         if (auto lib = SharedLib.load( `comctl32.dll`) ) {
374             char[] name = "DllGetVersion\0"; //$NON-NLS-1$
375             void* DllGetVersion = lib.getSymbol(name.ptr);
376             if (DllGetVersion !is null){
377                 alias extern(Windows) void function(DLLVERSIONINFO*) TDllVersion;
378                 TDllVersion f = cast( TDllVersion )DllGetVersion;
379                 f(&dvi);
380             }
381             lib.unload();
382         }
383         COMCTL32_MAJOR = dvi.dwMajorVersion;
384         COMCTL32_MINOR = dvi.dwMinorVersion;
385         COMCTL32_VERSION = VERSION (COMCTL32_MAJOR, COMCTL32_MINOR);
386
387         /* Get the Shell32.DLL version */
388         dvi = DLLVERSIONINFO.init;
389         dvi.cbSize = DLLVERSIONINFO.sizeof;
390         dvi.dwMajorVersion = 4;
391         //TCHAR lpLibFileName = new TCHAR (0, "Shell32.dll", true); //$NON-NLS-1$
392         //int /*long*/ hModule = OS.LoadLibrary (lpLibFileName);
393         if ( auto lib = SharedLib.load( `Shell32.dll`)) {
394             char[] name = "DllGetVersion\0"; //$NON-NLS-1$
395             void* DllGetVersion = lib.getSymbol(name.ptr);
396             if (DllGetVersion !is null){
397                 alias extern(Windows) void function(DLLVERSIONINFO*) TDllVersion;
398                 TDllVersion f = cast( TDllVersion )DllGetVersion;
399                 f(&dvi);
400             }
401             lib.unload();
402         }
403         SHELL32_MAJOR = dvi.dwMajorVersion;
404         SHELL32_MINOR = dvi.dwMinorVersion;
405         SHELL32_VERSION = VERSION (SHELL32_MAJOR, SHELL32_MINOR);
406     }
407
408     /**************************************************************************
409
410     **************************************************************************/
411
412     public static void enableVisualStyles() {
413         void printError( char[] msg ){
414             char[] winMsg = SysError.lastMsg();
415             char[2000] buf;
416             Trace.formatln("{}: {}", msg, CodePage.from( winMsg, buf ) );
417         }
418         TCHAR[] buffer = new TCHAR[ MAX_PATH ];
419         buffer[] = 0;
420         HANDLE hModule = OS.GetLibraryHandle ();
421         while (OS.GetModuleFileName (hModule, buffer.ptr, buffer.length ) is buffer.length ) {
422             buffer.length = buffer.length + MAX_PATH;
423             buffer[] = 0;
424         }
425         auto hHeap = OS.GetProcessHeap ();
426         int byteCount = buffer.length * TCHAR.sizeof;
427         TCHAR* pszText = cast(TCHAR*) OS.HeapAlloc (hHeap, HEAP_ZERO_MEMORY, byteCount);
428         OS.MoveMemory (pszText, buffer.ptr, byteCount);
429
430         ACTCTX pActCtx;
431         pActCtx.cbSize = ACTCTX.sizeof;
432         pActCtx.dwFlags = 0
433             | ACTCTX_FLAG_RESOURCE_NAME_VALID
434             | ACTCTX_FLAG_SET_PROCESS_DEFAULT
435             ;
436         pActCtx.lpSource = pszText;
437         pActCtx.lpApplicationName = pszText;
438         pActCtx.lpResourceName = MANIFEST_RESOURCE_ID;
439         HANDLE hActCtx = OS.CreateActCtx (&pActCtx);
440         if (hActCtx is INVALID_HANDLE_VALUE){
441             printError("CreateActCtx failed, hence theme support will not be available\n"
442                     "Please check for:\n"
443                     " - missing link option -L/su:windows:5 or -L/su:console:5\n"
444                     " - missing link option -L/rc:dwt\n"
445                     " - resource file 'dwt.res' was not accessible by linker\n"
446                     );
447         }
448         else{
449             ULONG_PTR ulpActivationCookie;
450             if (!OS.ActivateActCtx(hActCtx, &ulpActivationCookie)){
451                 printError("ActivateActCtx failed" );
452             }
453         }
454
455         if (pszText !is null){
456             OS.HeapFree (hHeap, 0, pszText);
457         }
458
459         /*
460         * NOTE:  A single activation context is created and activated
461         * for the entire lifetime of the program.  It is deactivated
462         * and released by Windows when the program exits.
463         */
464     }
465
466     /**************************************************************************
467
468     **************************************************************************/
469
470     /* Flag used on WinCE */
471
472     static const int SYS_COLOR_INDEX_FLAG = OS.IsWinCE ? 0x40000000 : 0x0;
473
474     /*
475     * NOTE:  There is a bug in JVM 1.2 where loading
476     * a class with a large number of constants causes
477     * a segment fault to occur sometime later after
478     * the class is loaded.  The fix is to break the
479     * class up into a hierarchy of classes that each
480     * contain a smaller number of constants.  This
481     * fix is not necessary at this time but is required
482     * when all constants are uncommented.  We have not
483     * done the research to determine the limit.
484     */
485
486     /* Constants */
487     public static const int ABS_DOWNDISABLED = 8;
488     public static const int ABS_DOWNHOT = 6;
489     public static const int ABS_DOWNNORMAL = 5;
490     public static const int ABS_DOWNPRESSED = 7;
491     public static const int ABS_LEFTDISABLED = 12;
492     public static const int ABS_LEFTHOT = 10;
493     public static const int ABS_LEFTNORMAL = 9;
494     public static const int ABS_LEFTPRESSED = 11;
495     public static const int ABS_RIGHTDISABLED = 16;
496     public static const int ABS_RIGHTHOT = 14;
497     public static const int ABS_RIGHTNORMAL = 13;
498     public static const int ABS_RIGHTPRESSED = 15;
499     public static const int ABS_UPDISABLED = 4;
500     public static const int ABS_UPHOT = 2;
501     public static const int ABS_UPNORMAL = 1;
502     public static const int ABS_UPPRESSED = 3;
503     public static const int AC_SRC_OVER = 0;
504     public static const int AC_SRC_ALPHA = 1;
505 //  public static const int ACTCTX_FLAG_RESOURCE_NAME_VALID = 0x00000008;
506 //  public static const int ACTCTX_FLAG_SET_PROCESS_DEFAULT = 0x00000010;
507     public static const int ALTERNATE = 1;
508     public static const int ASSOCF_NOTRUNCATE = 0x00000020;
509     public static const int ASSOCF_INIT_IGNOREUNKNOWN = 0x400;
510     public static const int ASSOCSTR_COMMAND = 1;
511     public static const int ASSOCSTR_DEFAULTICON = 15;
512     public static const int ASSOCSTR_FRIENDLYAPPNAME = 4;
513     public static const int ASSOCSTR_FRIENDLYDOCNAME = 3;
514     public static const int AW_SLIDE = 0x00040000;
515     public static const int AW_ACTIVATE = 0x00020000;
516     public static const int AW_BLEND = 0x00080000;
517     public static const int AW_HIDE = 0x00010000;
518     public static const int AW_CENTER = 0x00000010;
519     public static const int AW_HOR_POSITIVE = 0x00000001;
520     public static const int AW_HOR_NEGATIVE = 0x00000002;
521     public static const int AW_VER_POSITIVE = 0x00000004;
522     public static const int AW_VER_NEGATIVE = 0x00000008;
523     public static const int ATTR_INPUT = 0x00;
524     public static const int ATTR_TARGET_CONVERTED = 0x01;
525     public static const int ATTR_CONVERTED = 0x02;
526     public static const int ATTR_TARGET_NOTCONVERTED = 0x03;
527     public static const int ATTR_INPUT_ERROR = 0x04;
528     public static const int ATTR_FIXEDCONVERTED = 0x05;
529     public static const int BCM_FIRST = 0x1600;
530     public static const int BCM_GETIDEALSIZE = BCM_FIRST + 0x1;
531     public static const int BCM_GETIMAGELIST = BCM_FIRST + 0x3;
532     public static const int BCM_GETNOTE = BCM_FIRST + 0xa;
533     public static const int BCM_GETNOTELENGTH = BCM_FIRST + 0xb;
534     public static const int BCM_SETIMAGELIST = BCM_FIRST + 0x2;
535     public static const int BCM_SETNOTE = BCM_FIRST + 0x9;
536     public static const int BDR_RAISEDOUTER = 0x0001;
537     public static const int BDR_SUNKENOUTER = 0x0002;
538     public static const int BDR_RAISEDINNER = 0x0004;
539     public static const int BDR_SUNKENINNER = 0x0008;
540     public static const int BDR_OUTER = 0x0003;
541     public static const int BDR_INNER = 0x000c;
542     public static const int BDR_RAISED = 0x0005;
543     public static const int BDR_SUNKEN = 0x000a;
544     public static const int BFFM_INITIALIZED = 0x1;
545     public static const int BFFM_SETSELECTION = IsUnicode ? 0x467 : 0x466;
546     public static const int BFFM_VALIDATEFAILED = IsUnicode ? 0x4 : 0x3;
547     public static const int BFFM_VALIDATEFAILED