comparison dwt/internal/win32/OS.d @ 19:ded98545bb1f

Device
author Frank Benoit <benoit@tionex.de>
date Sat, 26 Jan 2008 14:06:27 +0100
parents 1bea9f0c6f63
children f5482da87ed8
comparison
equal deleted inserted replaced
18:437c59646731 19:ded98545bb1f
1 /******************************************************************************* 1 /*******************************************************************************
2 * Copyright (c) 2000, 2007 IBM Corporation and others. 2 * Copyright (c) 2000, 2007 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials 3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0 4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at 5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html 6 * http://www.eclipse.org/legal/epl-v10.html
64 */ 64 */
65 public static const int VER_PLATFORM_WIN32s = 0; 65 public static const int VER_PLATFORM_WIN32s = 0;
66 public static const int VER_PLATFORM_WIN32_WINDOWS = 1; 66 public static const int VER_PLATFORM_WIN32_WINDOWS = 1;
67 public static const int VER_PLATFORM_WIN32_NT = 2; 67 public static const int VER_PLATFORM_WIN32_NT = 2;
68 public static const int VER_PLATFORM_WIN32_CE = 3; 68 public static const int VER_PLATFORM_WIN32_CE = 3;
69 69
70 /* Forward references */ 70 /* Forward references */
71 public static const int HEAP_ZERO_MEMORY = 0x8; 71 public static const int HEAP_ZERO_MEMORY = 0x8;
72 public static const int ACTCTX_FLAG_RESOURCE_NAME_VALID = 0x00000008; 72 public static const int ACTCTX_FLAG_RESOURCE_NAME_VALID = 0x00000008;
73 public static const int ACTCTX_FLAG_SET_PROCESS_DEFAULT = 0x00000010; 73 public static const int ACTCTX_FLAG_SET_PROCESS_DEFAULT = 0x00000010;
74 public static const int MANIFEST_RESOURCE_ID = 2; 74 public static const int MANIFEST_RESOURCE_ID = 2;
108 /* 108 /*
109 * Try the UNICODE version of GetVersionEx first 109 * Try the UNICODE version of GetVersionEx first
110 * and then the ANSI version. The UNICODE version 110 * and then the ANSI version. The UNICODE version
111 * is present on all versions of Windows but is not 111 * is present on all versions of Windows but is not
112 * implemented on Win95/98/ME. 112 * implemented on Win95/98/ME.
113 * 113 *
114 * NOTE: The value of OSVERSIONINFO.sizeof cannot 114 * NOTE: The value of OSVERSIONINFO.sizeof cannot
115 * be static final because it relies on the Windows 115 * be static final because it relies on the Windows
116 * platform version to be initialized and IsUnicode 116 * platform version to be initialized and IsUnicode
117 * has not been calculated. It must be initialized 117 * has not been calculated. It must be initialized
118 * here, after the platform is determined in order 118 * here, after the platform is determined in order
137 IsWin95 = (info.dwPlatformId is VER_PLATFORM_WIN32_WINDOWS); 137 IsWin95 = (info.dwPlatformId is VER_PLATFORM_WIN32_WINDOWS);
138 IsWinNT = (info.dwPlatformId is VER_PLATFORM_WIN32_NT); 138 IsWinNT = (info.dwPlatformId is VER_PLATFORM_WIN32_NT);
139 IsWinCE = (info.dwPlatformId is VER_PLATFORM_WIN32_CE); 139 IsWinCE = (info.dwPlatformId is VER_PLATFORM_WIN32_CE);
140 IsSP_ = IsSP(); 140 IsSP_ = IsSP();
141 IsPPC_ = IsPPC(); 141 IsPPC_ = IsPPC();
142 IsHPC = IsWinCE && !IsPPC && !IsSP; 142 IsHPC = IsWinCE && !IsPPC && !IsSP;
143 WIN32_MAJOR = info.dwMajorVersion; 143 WIN32_MAJOR = info.dwMajorVersion;
144 WIN32_MINOR = info.dwMinorVersion; 144 WIN32_MINOR = info.dwMinorVersion;
145 WIN32_VERSION = VERSION (WIN32_MAJOR, WIN32_MINOR); 145 WIN32_VERSION = VERSION (WIN32_MAJOR, WIN32_MINOR);
146 IsUnicode = !IsWin32s && !IsWin95; 146 IsUnicode = !IsWin32s && !IsWin95;
147 147
154 buffer = new TCHAR (0, buffer.length () + MAX_PATH); 154 buffer = new TCHAR (0, buffer.length () + MAX_PATH);
155 } 155 }
156 int /*long*/ hHeap = OS.GetProcessHeap (); 156 int /*long*/ hHeap = OS.GetProcessHeap ();
157 int byteCount = buffer.length () * TCHAR.sizeof; 157 int byteCount = buffer.length () * TCHAR.sizeof;
158 int /*long*/ pszText = OS.HeapAlloc (hHeap, HEAP_ZERO_MEMORY, byteCount); 158 int /*long*/ pszText = OS.HeapAlloc (hHeap, HEAP_ZERO_MEMORY, byteCount);
159 OS.MoveMemory (pszText, buffer, byteCount); 159 OS.MoveMemory (pszText, buffer, byteCount);
160 ACTCTX pActCtx = new ACTCTX (); 160 ACTCTX pActCtx = new ACTCTX ();
161 pActCtx.cbSize = ACTCTX.sizeof; 161 pActCtx.cbSize = ACTCTX.sizeof;
162 pActCtx.dwFlags = ACTCTX_FLAG_RESOURCE_NAME_VALID | ACTCTX_FLAG_SET_PROCESS_DEFAULT; 162 pActCtx.dwFlags = ACTCTX_FLAG_RESOURCE_NAME_VALID | ACTCTX_FLAG_SET_PROCESS_DEFAULT;
163 pActCtx.lpSource = pszText; 163 pActCtx.lpSource = pszText;
164 pActCtx.lpResourceName = MANIFEST_RESOURCE_ID; 164 pActCtx.lpResourceName = MANIFEST_RESOURCE_ID;
171 * for the entire lifetime of the program. It is deactivated 171 * for the entire lifetime of the program. It is deactivated
172 * and released by Windows when the program exits. 172 * and released by Windows when the program exits.
173 */ 173 */
174 } 174 }
175 } 175 }
176 176
177 /* Make the process DPI aware for Windows Vista */ 177 /* Make the process DPI aware for Windows Vista */
178 if (OS.WIN32_VERSION >= OS.VERSION (6, 0)) OS.SetProcessDPIAware (); 178 if (OS.WIN32_VERSION >= OS.VERSION (6, 0)) OS.SetProcessDPIAware ();
179 179
180 /* Get the DBCS flag */ 180 /* Get the DBCS flag */
181 BOOL dbcsEnabled = OS.GetSystemMetrics (SM_DBCSENABLED) !is 0; 181 BOOL dbcsEnabled = OS.GetSystemMetrics (SM_DBCSENABLED) !is 0;
182 BOOL immEnabled = OS.GetSystemMetrics (SM_IMMENABLED) !is 0; 182 BOOL immEnabled = OS.GetSystemMetrics (SM_IMMENABLED) !is 0;
183 IsDBLocale = dbcsEnabled || immEnabled; 183 IsDBLocale = dbcsEnabled || immEnabled;
184 184
185 /* 185 /*
186 * Bug in Windows. On Korean Windows XP when the Text 186 * Bug in Windows. On Korean Windows XP when the Text
187 * Services Framework support for legacy applications 187 * Services Framework support for legacy applications
188 * is enabled, certain legacy calls segment fault. 188 * is enabled, certain legacy calls segment fault.
189 * For example, when ImmSetCompositionWindow() is used 189 * For example, when ImmSetCompositionWindow() is used
190 * to move the composition window outside of the client 190 * to move the composition window outside of the client
191 * area, Windows crashes. The fix is to disable legacy 191 * area, Windows crashes. The fix is to disable legacy
192 * support. 192 * support.
193 * 193 *
194 * Note: The bug is fixed in Service Pack 2. 194 * Note: The bug is fixed in Service Pack 2.
195 */ 195 */
196 if (!OS.IsWinCE && OS.WIN32_VERSION is OS.VERSION (5, 1)) { 196 if (!OS.IsWinCE && OS.WIN32_VERSION is OS.VERSION (5, 1)) {
197 short langID = OS.GetSystemDefaultUILanguage (); 197 short langID = OS.GetSystemDefaultUILanguage ();
198 short primaryLang = OS.PRIMARYLANGID (langID); 198 short primaryLang = OS.PRIMARYLANGID (langID);
204 OS.ImmDisableTextFrameService (0); 204 OS.ImmDisableTextFrameService (0);
205 } 205 }
206 } 206 }
207 } 207 }
208 } 208 }
209 209
210 /* Get the COMCTL32.DLL version */ 210 /* Get the COMCTL32.DLL version */
211 static this() { 211 static this() {
212 DLLVERSIONINFO dvi = new DLLVERSIONINFO (); 212 DLLVERSIONINFO dvi = new DLLVERSIONINFO ();
213 dvi.cbSize = DLLVERSIONINFO.sizeof; 213 dvi.cbSize = DLLVERSIONINFO.sizeof;
214 dvi.dwMajorVersion = 4; 214 dvi.dwMajorVersion = 4;
227 } 227 }
228 COMCTL32_MAJOR = dvi.dwMajorVersion; 228 COMCTL32_MAJOR = dvi.dwMajorVersion;
229 COMCTL32_MINOR = dvi.dwMinorVersion; 229 COMCTL32_MINOR = dvi.dwMinorVersion;
230 COMCTL32_VERSION = VERSION (COMCTL32_MAJOR, COMCTL32_MINOR); 230 COMCTL32_VERSION = VERSION (COMCTL32_MAJOR, COMCTL32_MINOR);
231 } 231 }
232 232
233 /* Get the Shell32.DLL version */ 233 /* Get the Shell32.DLL version */
234 static { 234 static {
235 DLLVERSIONINFO dvi = new DLLVERSIONINFO (); 235 DLLVERSIONINFO dvi = new DLLVERSIONINFO ();
236 dvi.cbSize = DLLVERSIONINFO.sizeof; 236 dvi.cbSize = DLLVERSIONINFO.sizeof;
237 dvi.dwMajorVersion = 4; 237 dvi.dwMajorVersion = 4;
255 255
256 /* Flag used on WinCE */ 256 /* Flag used on WinCE */
257 static const int SYS_COLOR_INDEX_FLAG = OS.IsWinCE ? 0x40000000 : 0x0; 257 static const int SYS_COLOR_INDEX_FLAG = OS.IsWinCE ? 0x40000000 : 0x0;
258 258
259 /* 259 /*
260 * NOTE: There is a bug in JVM 1.2 where loading 260 * NOTE: There is a bug in JVM 1.2 where loading
261 * a class with a large number of constants causes 261 * a class with a large number of constants causes
262 * a segment fault to occur sometime later after 262 * a segment fault to occur sometime later after
263 * the class is loaded. The fix is to break the 263 * the class is loaded. The fix is to break the
264 * class up into a hierarchy of classes that each 264 * class up into a hierarchy of classes that each
265 * contain a smaller number of constants. This 265 * contain a smaller number of constants. This
322 public static const int BFFM_INITIALIZED = 0x1; 322 public static const int BFFM_INITIALIZED = 0x1;
323 public static const int BFFM_SETSELECTION = IsUnicode ? 0x467 : 0x466; 323 public static const int BFFM_SETSELECTION = IsUnicode ? 0x467 : 0x466;
324 public static const int BFFM_VALIDATEFAILED = IsUnicode ? 0x4 : 0x3; 324 public static const int BFFM_VALIDATEFAILED = IsUnicode ? 0x4 : 0x3;
325 public static const int BFFM_VALIDATEFAILEDW = 0x4; 325 public static const int BFFM_VALIDATEFAILEDW = 0x4;
326 public static const int BFFM_VALIDATEFAILEDA = 0x3; 326 public static const int BFFM_VALIDATEFAILEDA = 0x3;
327 public static const int BF_ADJUST = 0x2000; 327 public static const int BF_ADJUST = 0x2000;
328 public static const int BF_LEFT = 0x0001; 328 public static const int BF_LEFT = 0x0001;
329 public static const int BF_TOP = 0x0002; 329 public static const int BF_TOP = 0x0002;
330 public static const int BF_RIGHT = 0x0004; 330 public static const int BF_RIGHT = 0x0004;
331 public static const int BF_BOTTOM = 0x0008; 331 public static const int BF_BOTTOM = 0x0008;
332 public static const int BF_RECT = (BF_LEFT | BF_TOP | BF_RIGHT | BF_BOTTOM); 332 public static const int BF_RECT = (BF_LEFT | BF_TOP | BF_RIGHT | BF_BOTTOM);
595 public static const int DT_SINGLELINE = 0x20; 595 public static const int DT_SINGLELINE = 0x20;
596 public static const int DT_TOP = 0; 596 public static const int DT_TOP = 0;
597 public static const int DT_VCENTER = 4; 597 public static const int DT_VCENTER = 4;
598 public static const int DT_WORDBREAK = 0x10; 598 public static const int DT_WORDBREAK = 0x10;
599 public static const int DTM_FIRST = 0x1000; 599 public static const int DTM_FIRST = 0x1000;
600 public static const int DTM_GETSYSTEMTIME = DTM_FIRST + 1; 600 public static const int DTM_GETSYSTEMTIME = DTM_FIRST + 1;
601 public static const int DTM_SETFORMAT = IsUnicode ? DTM_FIRST + 50 : DTM_FIRST + 5; 601 public static const int DTM_SETFORMAT = IsUnicode ? DTM_FIRST + 50 : DTM_FIRST + 5;
602 public static const int DTM_SETSYSTEMTIME = DTM_FIRST + 2; 602 public static const int DTM_SETSYSTEMTIME = DTM_FIRST + 2;
603 public static const int DTN_FIRST = 0xFFFFFD08; 603 public static const int DTN_FIRST = 0xFFFFFD08;
604 public static const int DTN_DATETIMECHANGE = DTN_FIRST + 1; 604 public static const int DTN_DATETIMECHANGE = DTN_FIRST + 1;
605 public static const int DTS_LONGDATEFORMAT = 0x0004; 605 public static const int DTS_LONGDATEFORMAT = 0x0004;
684 public static const int EVENT_OBJECT_VALUECHANGE = 0x800E; 684 public static const int EVENT_OBJECT_VALUECHANGE = 0x800E;
685 public static const int FALT = 0x10; 685 public static const int FALT = 0x10;
686 public static const int FCONTROL = 0x8; 686 public static const int FCONTROL = 0x8;
687 public static const int FE_FONTSMOOTHINGCLEARTYPE = 0x0002; 687 public static const int FE_FONTSMOOTHINGCLEARTYPE = 0x0002;
688 public static const int FEATURE_DISABLE_NAVIGATION_SOUNDS = 21; 688 public static const int FEATURE_DISABLE_NAVIGATION_SOUNDS = 21;
689 public static const int FILE_ATTRIBUTE_NORMAL = 0x00000080; 689 public static const int FILE_ATTRIBUTE_NORMAL = 0x00000080;
690 public static const int FNERR_INVALIDFILENAME = 0x3002; 690 public static const int FNERR_INVALIDFILENAME = 0x3002;
691 public static const int FNERR_BUFFERTOOSMALL = 0x3003; 691 public static const int FNERR_BUFFERTOOSMALL = 0x3003;
692 public static const int FORMAT_MESSAGE_ALLOCATE_BUFFER = 0x00000100; 692 public static const int FORMAT_MESSAGE_ALLOCATE_BUFFER = 0x00000100;
693 public static const int FORMAT_MESSAGE_FROM_SYSTEM = 0x00001000; 693 public static const int FORMAT_MESSAGE_FROM_SYSTEM = 0x00001000;
694 public static const int FORMAT_MESSAGE_IGNORE_INSERTS = 0x00000200; 694 public static const int FORMAT_MESSAGE_IGNORE_INSERTS = 0x00000200;
933 public static const int LCID_SUPPORTED = 0x2; 933 public static const int LCID_SUPPORTED = 0x2;
934 public static const int LOCALE_IDEFAULTANSICODEPAGE = 0x1004; 934 public static const int LOCALE_IDEFAULTANSICODEPAGE = 0x1004;
935 public static const int LOCALE_IDATE = 0x00000021; 935 public static const int LOCALE_IDATE = 0x00000021;
936 public static const int LOCALE_ITIME = 0x00000023; 936 public static const int LOCALE_ITIME = 0x00000023;
937 public static const int LOCALE_RETURN_NUMBER = 0x20000000; // #if(WINVER >= 0x0400) 937 public static const int LOCALE_RETURN_NUMBER = 0x20000000; // #if(WINVER >= 0x0400)
938 public static const int LOCALE_S1159 = 0x00000028; 938 public static const int LOCALE_S1159 = 0x00000028;
939 public static const int LOCALE_S2359 = 0x00000029; 939 public static const int LOCALE_S2359 = 0x00000029;
940 public static const int LOCALE_SDECIMAL = 14; 940 public static const int LOCALE_SDECIMAL = 14;
941 public static const int LOCALE_SISO3166CTRYNAME = 0x5a; 941 public static const int LOCALE_SISO3166CTRYNAME = 0x5a;
942 public static const int LOCALE_SISO639LANGNAME = 0x59; 942 public static const int LOCALE_SISO639LANGNAME = 0x59;
943 public static const int LOCALE_SLONGDATE = 0x00000020; 943 public static const int LOCALE_SLONGDATE = 0x00000020;
944 public static const int LOCALE_SSHORTDATE = 0x0000001F; 944 public static const int LOCALE_SSHORTDATE = 0x0000001F;
945 public static const int LOCALE_STIMEFORMAT = 0x00001003; 945 public static const int LOCALE_STIMEFORMAT = 0x00001003;
1107 public static const int MB_YESNOCANCEL = 0x3; 1107 public static const int MB_YESNOCANCEL = 0x3;
1108 public static const int MCM_FIRST = 0x1000; 1108 public static const int MCM_FIRST = 0x1000;
1109 public static const int MCM_GETCURSEL = MCM_FIRST + 1; 1109 public static const int MCM_GETCURSEL = MCM_FIRST + 1;
1110 public static const int MCM_SETCURSEL = MCM_FIRST + 2; 1110 public static const int MCM_SETCURSEL = MCM_FIRST + 2;
1111 public static const int MCN_FIRST = 0xFFFFFD12; 1111 public static const int MCN_FIRST = 0xFFFFFD12;
1112 public static const int MCN_SELCHANGE = MCN_FIRST + 1; 1112 public static const int MCN_SELCHANGE = MCN_FIRST + 1;
1113 public static const int MCM_GETMINREQRECT = MCM_FIRST + 9; 1113 public static const int MCM_GETMINREQRECT = MCM_FIRST + 9;
1114 public static const int MCS_NOTODAY = 0x0010; 1114 public static const int MCS_NOTODAY = 0x0010;
1115 public static const int MDIS_ALLCHILDSTYLES = 0x0001; 1115 public static const int MDIS_ALLCHILDSTYLES = 0x0001;
1116 public static const int MFS_CHECKED = 0x8; 1116 public static const int MFS_CHECKED = 0x8;
1117 public static const int MFS_DISABLED = 0x3; 1117 public static const int MFS_DISABLED = 0x3;
1118 public static const int MFS_GRAYED = 0x3; 1118 public static const int MFS_GRAYED = 0x3;
1119 public static const int MFT_RADIOCHECK = 0x200; 1119 public static const int MFT_RADIOCHECK = 0x200;
1120 public static const int MFT_RIGHTJUSTIFY = 0x4000; 1120 public static const int MFT_RIGHTJUSTIFY = 0x4000;
1121 public static const int MFT_RIGHTORDER = 0x2000; 1121 public static const int MFT_RIGHTORDER = 0x2000;
1122 public static const int MFT_SEPARATOR = 0x800; 1122 public static const int MFT_SEPARATOR = 0x800;
1123 public static const int MFT_STRING = 0x0; 1123 public static const int MFT_STRING = 0x0;
1124 public static const int MF_BYCOMMAND = 0x0; 1124 public static const int MF_BYCOMMAND = 0x0;
1125 public static const int MF_BYPOSITION = 0x400; 1125 public static const int MF_BYPOSITION = 0x400;
1126 public static const int MF_CHECKED = 0x8; 1126 public static const int MF_CHECKED = 0x8;
1153 public static const int MNS_CHECKORBMP = 0x4000000; 1153 public static const int MNS_CHECKORBMP = 0x4000000;
1154 public static const int MONITOR_DEFAULTTONEAREST = 0x2; 1154 public static const int MONITOR_DEFAULTTONEAREST = 0x2;
1155 public static const int MONITORINFOF_PRIMARY = 0x1; 1155 public static const int MONITORINFOF_PRIMARY = 0x1;
1156 public static const char[] MONTHCAL_CLASS = "SysMonthCal32"; //$NON-NLS-1$ 1156 public static const char[] MONTHCAL_CLASS = "SysMonthCal32"; //$NON-NLS-1$
1157 public static const int MOUSEEVENTF_ABSOLUTE = 0x8000; 1157 public static const int MOUSEEVENTF_ABSOLUTE = 0x8000;
1158 public static const int MOUSEEVENTF_LEFTDOWN = 0x0002; 1158 public static const int MOUSEEVENTF_LEFTDOWN = 0x0002;
1159 public static const int MOUSEEVENTF_LEFTUP = 0x0004; 1159 public static const int MOUSEEVENTF_LEFTUP = 0x0004;
1160 public static const int MOUSEEVENTF_MIDDLEDOWN = 0x0020; 1160 public static const int MOUSEEVENTF_MIDDLEDOWN = 0x0020;
1161 public static const int MOUSEEVENTF_MIDDLEUP = 0x0040; 1161 public static const int MOUSEEVENTF_MIDDLEUP = 0x0040;
1162 public static const int MOUSEEVENTF_MOVE = 0x0001; 1162 public static const int MOUSEEVENTF_MOVE = 0x0001;
1163 public static const int MOUSEEVENTF_RIGHTDOWN = 0x0008; 1163 public static const int MOUSEEVENTF_RIGHTDOWN = 0x0008;
1164 public static const int MOUSEEVENTF_RIGHTUP = 0x0010; 1164 public static const int MOUSEEVENTF_RIGHTUP = 0x0010;
1165 public static const int MOUSEEVENTF_VIRTUALDESK = 0x4000; 1165 public static const int MOUSEEVENTF_VIRTUALDESK = 0x4000;
1166 public static const int MOUSEEVENTF_WHEEL = 0x0800; 1166 public static const int MOUSEEVENTF_WHEEL = 0x0800;
1167 public static const int MOUSEEVENTF_XDOWN = 0x0080; 1167 public static const int MOUSEEVENTF_XDOWN = 0x0080;
1168 public static const int MOUSEEVENTF_XUP = 0x0100; 1168 public static const int MOUSEEVENTF_XUP = 0x0100;
1251 public static const int PBS_MARQUEE = 0x08; 1251 public static const int PBS_MARQUEE = 0x08;
1252 public static const int PBS_SMOOTH = 0x1; 1252 public static const int PBS_SMOOTH = 0x1;
1253 public static const int PBS_VERTICAL = 0x4; 1253 public static const int PBS_VERTICAL = 0x4;
1254 public static const int PBS_NORMAL = 1; 1254 public static const int PBS_NORMAL = 1;
1255 public static const int PBS_HOT = 2; 1255 public static const int PBS_HOT = 2;
1256 public static const int PBS_PRESSED = 3; 1256 public static const int PBS_PRESSED = 3;
1257 public static const int PBS_DISABLED = 4; 1257 public static const int PBS_DISABLED = 4;
1258 public static const int PBS_DEFAULTED = 5; 1258 public static const int PBS_DEFAULTED = 5;
1259 public static const int PBST_NORMAL = 0x0001; 1259 public static const int PBST_NORMAL = 0x0001;
1260 public static const int PBST_ERROR = 0x0002; 1260 public static const int PBST_ERROR = 0x0002;
1261 public static const int PBST_PAUSED = 0x0003; 1261 public static const int PBST_PAUSED = 0x0003;
1568 public static const int TBSTATE_PRESSED = 0x02; 1568 public static const int TBSTATE_PRESSED = 0x02;
1569 public static const int TBSTYLE_CUSTOMERASE = 0x2000; 1569 public static const int TBSTYLE_CUSTOMERASE = 0x2000;
1570 public static const int TBSTYLE_DROPDOWN = 0x8; 1570 public static const int TBSTYLE_DROPDOWN = 0x8;
1571 public static const int TBSTATE_ENABLED = 0x4; 1571 public static const int TBSTATE_ENABLED = 0x4;
1572 public static const int TBSTYLE_AUTOSIZE = 0x10; 1572 public static const int TBSTYLE_AUTOSIZE = 0x10;
1573 public static const int TBSTYLE_EX_DOUBLEBUFFER = 0x80; 1573 public static const int TBSTYLE_EX_DOUBLEBUFFER = 0x80;
1574 public static const int TBSTYLE_EX_DRAWDDARROWS = 0x1; 1574 public static const int TBSTYLE_EX_DRAWDDARROWS = 0x1;
1575 public static const int TBSTYLE_EX_HIDECLIPPEDBUTTONS = 0x10; 1575 public static const int TBSTYLE_EX_HIDECLIPPEDBUTTONS = 0x10;
1576 public static const int TBSTYLE_EX_MIXEDBUTTONS = 0x8; 1576 public static const int TBSTYLE_EX_MIXEDBUTTONS = 0x8;
1577 public static const int TBSTYLE_FLAT = 0x800; 1577 public static const int TBSTYLE_FLAT = 0x800;
1578 public static const int TBSTYLE_LIST = 0x1000; 1578 public static const int TBSTYLE_LIST = 0x1000;
1711 public static const int TTM_GETCURRENTTOOL = 0x400 + (IsUnicode ? 59 : 15); 1711 public static const int TTM_GETCURRENTTOOL = 0x400 + (IsUnicode ? 59 : 15);
1712 public static const int TTM_GETDELAYTIME = 0x400 + 21; 1712 public static const int TTM_GETDELAYTIME = 0x400 + 21;
1713 public static const int TTM_DELTOOL = IsUnicode ? 0x433 : 0x405; 1713 public static const int TTM_DELTOOL = IsUnicode ? 0x433 : 0x405;
1714 public static const int TTM_GETTOOLINFO = 0x400 + (IsUnicode ? 53 : 8); 1714 public static const int TTM_GETTOOLINFO = 0x400 + (IsUnicode ? 53 : 8);
1715 public static const int TTM_NEWTOOLRECT = 0x400 + (IsUnicode ? 52 : 6); 1715 public static const int TTM_NEWTOOLRECT = 0x400 + (IsUnicode ? 52 : 6);
1716 public static const int TTM_POP = 0x400 + 28; 1716 public static const int TTM_POP = 0x400 + 28;
1717 public static const int TTM_SETDELAYTIME = 0x400 + 3; 1717 public static const int TTM_SETDELAYTIME = 0x400 + 3;
1718 public static const int TTM_SETMAXTIPWIDTH = 0x418; 1718 public static const int TTM_SETMAXTIPWIDTH = 0x418;
1719 public static const int TTM_SETTITLEA = 0x400 + 32; 1719 public static const int TTM_SETTITLEA = 0x400 + 32;
1720 public static const int TTM_SETTITLEW = 0x400 + 33; 1720 public static const int TTM_SETTITLEW = 0x400 + 33;
1721 public static const int TTM_SETTITLE = 0x400 + (IsUnicode ? 33 : 32); 1721 public static const int TTM_SETTITLE = 0x400 + (IsUnicode ? 33 : 32);
1947 public static const int WM_CLEAR = 0x303; 1947 public static const int WM_CLEAR = 0x303;
1948 public static const int WM_CLOSE = 0x10; 1948 public static const int WM_CLOSE = 0x10;
1949 public static const int WM_COMMAND = 0x111; 1949 public static const int WM_COMMAND = 0x111;
1950 public static const int WM_CONTEXTMENU = 0x7b; 1950 public static const int WM_CONTEXTMENU = 0x7b;
1951 public static const int WM_COPY = 0x301; 1951 public static const int WM_COPY = 0x301;
1952 public static const int WM_CREATE = 0x0001; 1952 public static const int WM_CREATE = 0x0001;
1953 public static const int WM_CTLCOLORBTN = 0x135; 1953 public static const int WM_CTLCOLORBTN = 0x135;
1954 public static const int WM_CTLCOLORDLG = 0x136; 1954 public static const int WM_CTLCOLORDLG = 0x136;
1955 public static const int WM_CTLCOLOREDIT = 0x133; 1955 public static const int WM_CTLCOLOREDIT = 0x133;
1956 public static const int WM_CTLCOLORLISTBOX = 0x134; 1956 public static const int WM_CTLCOLORLISTBOX = 0x134;
1957 public static const int WM_CTLCOLORMSGBOX = 0x132; 1957 public static const int WM_CTLCOLORMSGBOX = 0x132;
2077 public static const int WM_XBUTTONDOWN = 0x020B; 2077 public static const int WM_XBUTTONDOWN = 0x020B;
2078 public static const int WM_XBUTTONUP = 0x020C; 2078 public static const int WM_XBUTTONUP = 0x020C;
2079 public static const int WM_XBUTTONDBLCLK = 0x020D; 2079 public static const int WM_XBUTTONDBLCLK = 0x020D;
2080 public static const int XBUTTON1 = 0x1; 2080 public static const int XBUTTON1 = 0x1;
2081 public static const int XBUTTON2 = 0x2; 2081 public static const int XBUTTON2 = 0x2;
2082 2082
2083 2083
2084 //PORTING_LEFT 2084 //PORTING_LEFT
2085 /++ 2085 /++
2086 /** Ansi/Unicode wrappers */ 2086 /** Ansi/Unicode wrappers */
2087 2087
2276 2276
2277 public static final int /*long*/ FindWindow (TCHAR lpClassName, TCHAR lpWindowName) { 2277 public static final int /*long*/ FindWindow (TCHAR lpClassName, TCHAR lpWindowName) {
2278 if (IsUnicode) { 2278 if (IsUnicode) {
2279 char [] lpClassName1 = lpClassName is null ? null : lpClassName.chars; 2279 char [] lpClassName1 = lpClassName is null ? null : lpClassName.chars;
2280 char [] lpWindowName1 = lpWindowName is null ? null : lpWindowName.chars; 2280 char [] lpWindowName1 = lpWindowName is null ? null : lpWindowName.chars;
2281 return FindWindowW (lpClassName1, lpWindowName1); 2281 return FindWindowW (lpClassName1, lpWindowName1);
2282 } 2282 }
2283 byte [] lpClassName1 = lpClassName is null ? null : lpClassName.bytes; 2283 byte [] lpClassName1 = lpClassName is null ? null : lpClassName.bytes;
2284 byte [] lpWindowName1 = lpWindowName is null ? null : lpWindowName.bytes; 2284 byte [] lpWindowName1 = lpWindowName is null ? null : lpWindowName.bytes;
2285 return FindWindowA (lpClassName1, lpWindowName1); 2285 return FindWindowA (lpClassName1, lpWindowName1);
2286 } 2286 }
2287 2287
2288 public static final int FormatMessage (int dwFlags, int /*long*/ lpSource, int dwMessageId, int dwLanguageId, int[] lpBuffer, int nSize, int /*long*/ Arguments) { 2288 public static final int FormatMessage (int dwFlags, int /*long*/ lpSource, int dwMessageId, int dwLanguageId, int[] lpBuffer, int nSize, int /*long*/ Arguments) {
2289 if (IsUnicode) { 2289 if (IsUnicode) {
2290 return FormatMessageW (dwFlags, lpSource, dwMessageId, dwLanguageId, lpBuffer, nSize, Arguments); 2290 return FormatMessageW (dwFlags, lpSource, dwMessageId, dwLanguageId, lpBuffer, nSize, Arguments);
2291 } 2291 }
2292 return FormatMessageA (dwFlags, lpSource, dwMessageId, dwLanguageId, lpBuffer, nSize, Arguments); 2292 return FormatMessageA (dwFlags, lpSource, dwMessageId, dwLanguageId, lpBuffer, nSize, Arguments);
2293 } 2293 }
2294 2294
2295 public static final BOOL GetCharABCWidths (int /*long*/ hdc, int iFirstChar, int iLastChar, int [] lpabc) { 2295 public static final BOOL GetCharABCWidths (int /*long*/ hdc, int iFirstChar, int iLastChar, int [] lpabc) {
2301 if (IsUnicode) { 2301 if (IsUnicode) {
2302 char [] lpString1 = lpString is null ? null : lpString.chars; 2302 char [] lpString1 = lpString is null ? null : lpString.chars;
2303 return GetCharacterPlacementW (hdc, lpString1, nCount, nMaxExtent, lpResults, dwFlags); 2303 return GetCharacterPlacementW (hdc, lpString1, nCount, nMaxExtent, lpResults, dwFlags);
2304 } 2304 }
2305 byte [] lpString1 = lpString is null ? null : lpString.bytes; 2305 byte [] lpString1 = lpString is null ? null : lpString.bytes;
2306 return GetCharacterPlacementA (hdc, lpString1, nCount, nMaxExtent, lpResults, dwFlags); 2306 return GetCharacterPlacementA (hdc, lpString1, nCount, nMaxExtent, lpResults, dwFlags);
2307 } 2307 }
2308 2308
2309 public static final BOOL GetCharWidth (int /*long*/ hdc, int iFirstChar, int iLastChar, int [] lpabc) { 2309 public static final BOOL GetCharWidth (int /*long*/ hdc, int iFirstChar, int iLastChar, int [] lpabc) {
2310 if (IsUnicode) return GetCharWidthW (hdc,iFirstChar, iLastChar, lpabc); 2310 if (IsUnicode) return GetCharWidthW (hdc,iFirstChar, iLastChar, lpabc);
2311 return GetCharWidthA (hdc,iFirstChar, iLastChar, lpabc); 2311 return GetCharWidthA (hdc,iFirstChar, iLastChar, lpabc);
2477 if (IsUnicode) { 2477 if (IsUnicode) {
2478 char [] lpString1 = lpString is null ? null : lpString.chars; 2478 char [] lpString1 = lpString is null ? null : lpString.chars;
2479 return GetTextExtentPoint32W (hdc, lpString1, cbString, lpSize); 2479 return GetTextExtentPoint32W (hdc, lpString1, cbString, lpSize);
2480 } 2480 }
2481 byte [] lpString1 = lpString is null ? null : lpString.bytes; 2481 byte [] lpString1 = lpString is null ? null : lpString.bytes;
2482 return GetTextExtentPoint32A (hdc, lpString1, cbString, lpSize); 2482 return GetTextExtentPoint32A (hdc, lpString1, cbString, lpSize);
2483 } 2483 }
2484 2484
2485 public static final BOOL GetTextMetrics (int /*long*/ hdc, TEXTMETRIC lptm) { 2485 public static final BOOL GetTextMetrics (int /*long*/ hdc, TEXTMETRIC lptm) {
2486 if (IsUnicode) return GetTextMetricsW (hdc, (TEXTMETRICW)lptm); 2486 if (IsUnicode) return GetTextMetricsW (hdc, (TEXTMETRICW)lptm);
2487 return GetTextMetricsA (hdc, (TEXTMETRICA)lptm); 2487 return GetTextMetricsA (hdc, (TEXTMETRICA)lptm);
2564 if (IsUnicode) { 2564 if (IsUnicode) {
2565 char [] lpNewItem1 = lpNewItem is null ? null : lpNewItem.chars; 2565 char [] lpNewItem1 = lpNewItem is null ? null : lpNewItem.chars;
2566 return InsertMenuW (hMenu, uPosition, uFlags, uIDNewItem, lpNewItem1); 2566 return InsertMenuW (hMenu, uPosition, uFlags, uIDNewItem, lpNewItem1);
2567 } 2567 }
2568 byte [] lpNewItem1 = lpNewItem is null ? null : lpNewItem.bytes; 2568 byte [] lpNewItem1 = lpNewItem is null ? null : lpNewItem.bytes;
2569 return InsertMenuA (hMenu, uPosition, uFlags, uIDNewItem, lpNewItem1); 2569 return InsertMenuA (hMenu, uPosition, uFlags, uIDNewItem, lpNewItem1);
2570 } 2570 }
2571 2571
2572 public static final BOOL InsertMenuItem (int /*long*/ hMenu, int uItem, BOOL fByPosition, MENUITEMINFO lpmii) { 2572 public static final BOOL InsertMenuItem (int /*long*/ hMenu, int uItem, BOOL fByPosition, MENUITEMINFO lpmii) {
2573 if (IsUnicode) return InsertMenuItemW (hMenu, uItem, fByPosition, lpmii); 2573 if (IsUnicode) return InsertMenuItemW (hMenu, uItem, fByPosition, lpmii);
2574 return InsertMenuItemA (hMenu, uItem, fByPosition, lpmii); 2574 return InsertMenuItemA (hMenu, uItem, fByPosition, lpmii);
3083 public static final native int /*long*/ CallWindowProcA (int /*long*/ lpPrevWndFunc, int /*long*/ hWnd, int Msg, int /*long*/ wParam, int /*long*/ lParam); 3083 public static final native int /*long*/ CallWindowProcA (int /*long*/ lpPrevWndFunc, int /*long*/ hWnd, int Msg, int /*long*/ wParam, int /*long*/ lParam);
3084 public static final native short CharLowerW (short ch); 3084 public static final native short CharLowerW (short ch);
3085 public static final native short CharLowerA (short ch); 3085 public static final native short CharLowerA (short ch);
3086 public static final native short CharUpperW (short ch); 3086 public static final native short CharUpperW (short ch);
3087 public static final native short CharUpperA (short ch); 3087 public static final native short CharUpperA (short ch);
3088 public static final native BOOL CheckMenuItem (int /*long*/ hmenu, int uIDCheckItem, int uCheck); 3088 public static final native BOOL CheckMenuItem (int /*long*/ hmenu, int uIDCheckItem, int uCheck);
3089 public static final native BOOL ChooseColorW (CHOOSECOLOR lpcc); 3089 public static final native BOOL ChooseColorW (CHOOSECOLOR lpcc);
3090 public static final native BOOL ChooseColorA (CHOOSECOLOR lpcc); 3090 public static final native BOOL ChooseColorA (CHOOSECOLOR lpcc);
3091 public static final native BOOL ChooseFontW (CHOOSEFONT chooseFont); 3091 public static final native BOOL ChooseFontW (CHOOSEFONT chooseFont);
3092 public static final native BOOL ChooseFontA (CHOOSEFONT chooseFont); 3092 public static final native BOOL ChooseFontA (CHOOSEFONT chooseFont);
3093 public static final native BOOL ClientToScreen (int /*long*/ hWnd, POINT lpPoint); 3093 public static final native BOOL ClientToScreen (int /*long*/ hWnd, POINT lpPoint);
3105 public static final native int CommandBar_Height (int /*long*/ hdnwCB); 3105 public static final native int CommandBar_Height (int /*long*/ hdnwCB);
3106 public static final native BOOL CommandBar_InsertMenubarEx (int /*long*/ hwndCB, int /*long*/ hInst, int /*long*/ pszMenu, int iButton); 3106 public static final native BOOL CommandBar_InsertMenubarEx (int /*long*/ hwndCB, int /*long*/ hInst, int /*long*/ pszMenu, int iButton);
3107 public static final native BOOL CommandBar_Show (int /*long*/ hwndCB, BOOL fShow); 3107 public static final native BOOL CommandBar_Show (int /*long*/ hwndCB, BOOL fShow);
3108 public static final native int CommDlgExtendedError (); 3108 public static final native int CommDlgExtendedError ();
3109 public static final native int /*long*/ CopyImage (int /*long*/ hImage, int uType, int cxDesired, int cyDesired, int fuFlags); 3109 public static final native int /*long*/ CopyImage (int /*long*/ hImage, int uType, int cxDesired, int cyDesired, int fuFlags);
3110 public static final native int /*long*/ CreateAcceleratorTableW (byte [] lpaccl, int cEntries); 3110 public static final native int /*long*/ CreateAcceleratorTableW (byte [] lpaccl, int cEntries);
3111 public static final native int /*long*/ CreateAcceleratorTableA (byte [] lpaccl, int cEntries); 3111 public static final native int /*long*/ CreateAcceleratorTableA (byte [] lpaccl, int cEntries);
3112 public static final native int /*long*/ CreateActCtxW (ACTCTX pActCtx); 3112 public static final native int /*long*/ CreateActCtxW (ACTCTX pActCtx);
3113 public static final native int /*long*/ CreateActCtxA (ACTCTX pActCtx); 3113 public static final native int /*long*/ CreateActCtxA (ACTCTX pActCtx);
3114 public static final native int /*long*/ CreateBitmap (int nWidth, int nHeight, int cPlanes, int cBitsPerPel, byte [] lpvBits); 3114 public static final native int /*long*/ CreateBitmap (int nWidth, int nHeight, int cPlanes, int cBitsPerPel, byte [] lpvBits);
3115 public static final native BOOL CreateCaret (int /*long*/ hWnd, int /*long*/ hBitmap, int nWidth, int nHeight); 3115 public static final native BOOL CreateCaret (int /*long*/ hWnd, int /*long*/ hBitmap, int nWidth, int nHeight);
3116 public static final native int /*long*/ CreateCompatibleBitmap (int /*long*/ hdc, int nWidth, int nHeight); 3116 public static final native int /*long*/ CreateCompatibleBitmap (int /*long*/ hdc, int nWidth, int nHeight);
3117 public static final native int /*long*/ CreateCompatibleDC (int /*long*/ hdc); 3117 public static final native int /*long*/ CreateCompatibleDC (int /*long*/ hdc);
3118 public static final native int /*long*/ CreateCursor (int /*long*/ hInst, int xHotSpot, int yHotSpot, int nWidth, int nHeight, byte [] pvANDPlane, byte [] pvXORPlane); 3118 public static final native int /*long*/ CreateCursor (int /*long*/ hInst, int xHotSpot, int yHotSpot, int nWidth, int nHeight, byte [] pvANDPlane, byte [] pvXORPlane);
3119 public static final native int /*long*/ CreateDCW (char [] lpszDriver, char [] lpszDevice, int /*long*/ lpszOutput, int /*long*/ lpInitData); 3119 public static final native int /*long*/ CreateDCW (char [] lpszDriver, char [] lpszDevice, int /*long*/ lpszOutput, int /*long*/ lpInitData);
3120 public static final native int /*long*/ CreateDCA (byte [] lpszDriver, byte [] lpszDevice, int /*long*/ lpszOutput, int /*long*/ lpInitData); 3120 public static final native int /*long*/ CreateDCA (byte [] lpszDriver, byte [] lpszDevice, int /*long*/ lpszOutput, int /*long*/ lpInitData);
3121 public static final native int /*long*/ CreateDIBSection(int /*long*/ hdc, byte[] pbmi, int iUsage, int /*long*/[] ppvBits, int /*long*/ hSection, int dwOffset); 3121 public static final native int /*long*/ CreateDIBSection(int /*long*/ hdc, byte[] pbmi, int iUsage, int /*long*/[] ppvBits, int /*long*/ hSection, int dwOffset);
3122 public static final native int /*long*/ CreateFontIndirectW (int /*long*/ lplf); 3122 public static final native int /*long*/ CreateFontIndirectW (int /*long*/ lplf);
3123 public static final native int /*long*/ CreateFontIndirectA (int /*long*/ lplf); 3123 public static final native int /*long*/ CreateFontIndirectA (int /*long*/ lplf);
3124 public static final native int /*long*/ CreateFontIndirectW (LOGFONTW lplf); 3124 public static final native int /*long*/ CreateFontIndirectW (LOGFONTW lplf);
3125 public static final native int /*long*/ CreateFontIndirectA (LOGFONTA lplf); 3125 public static final native int /*long*/ CreateFontIndirectA (LOGFONTA lplf);
3172 public static final native int DrawThemeBackground (int /*long*/ hTheme, int /*long*/ hdc, int iPartId, int iStateId, RECT pRect, RECT pClipRect); 3172 public static final native int DrawThemeBackground (int /*long*/ hTheme, int /*long*/ hdc, int iPartId, int iStateId, RECT pRect, RECT pClipRect);
3173 public static final native int DrawThemeEdge (int /*long*/ hTheme, int /*long*/ hdc, int iPartId, int iStateId, RECT pDestRect, int uEdge, int uFlags, RECT pContentRect); 3173 public static final native int DrawThemeEdge (int /*long*/ hTheme, int /*long*/ hdc, int iPartId, int iStateId, RECT pDestRect, int uEdge, int uFlags, RECT pContentRect);
3174 public static final native int DrawThemeIcon (int /*long*/ hTheme, int /*long*/ hdc, int iPartId, int iStateId, RECT pRect, int /*long*/ himl, int iImageIndex); 3174 public static final native int DrawThemeIcon (int /*long*/ hTheme, int /*long*/ hdc, int iPartId, int iStateId, RECT pRect, int /*long*/ himl, int iImageIndex);
3175 public static final native int DrawThemeParentBackground (int /*long*/ hwnd, int /*long*/ hdc, RECT prc); 3175 public static final native int DrawThemeParentBackground (int /*long*/ hwnd, int /*long*/ hdc, RECT prc);
3176 public static final native int DrawThemeText (int /*long*/ hTheme, int /*long*/ hdc, int iPartId, int iStateId, char[] pszText, int iCharCount, int dwTextFlags, int dwTextFlags2, RECT pRect); 3176 public static final native int DrawThemeText (int /*long*/ hTheme, int /*long*/ hdc, int iPartId, int iStateId, char[] pszText, int iCharCount, int dwTextFlags, int dwTextFlags2, RECT pRect);
3177 public static final native int DwmExtendFrameIntoClientArea (int /*long*/ hWnd, MARGINS pMarInset); 3177 public static final native int DwmExtendFrameIntoClientArea (int /*long*/ hWnd, MARGINS pMarInset);
3178 public static final native BOOL Ellipse (int /*long*/ hdc, int nLeftRect, int nTopRect, int nRightRect, int nBottomRect); 3178 public static final native BOOL Ellipse (int /*long*/ hdc, int nLeftRect, int nTopRect, int nRightRect, int nBottomRect);
3179 public static final native BOOL EnableMenuItem (int /*long*/ hMenu, int uIDEnableItem, int uEnable); 3179 public static final native BOOL EnableMenuItem (int /*long*/ hMenu, int uIDEnableItem, int uEnable);
3180 public static final native BOOL EnableScrollBar (int /*long*/ hWnd, int wSBflags, int wArrows); 3180 public static final native BOOL EnableScrollBar (int /*long*/ hWnd, int wSBflags, int wArrows);
3181 public static final native BOOL EnableWindow (int /*long*/ hWnd, BOOL bEnable); 3181 public static final native BOOL EnableWindow (int /*long*/ hWnd, BOOL bEnable);
3182 public static final native BOOL EnumSystemLanguageGroupsW(int /*long*/ pLangGroupEnumProc, int dwFlags, int /*long*/ lParam); 3182 public static final native BOOL EnumSystemLanguageGroupsW(int /*long*/ pLangGroupEnumProc, int dwFlags, int /*long*/ lParam);
3401 public static final native BOOL ImageList_DragShowNolock (BOOL fShow); 3401 public static final native BOOL ImageList_DragShowNolock (BOOL fShow);
3402 public static final native BOOL ImageList_Draw (int /*long*/ himl, int i, int /*long*/ hdcDst, int x, int y, int fStyle); 3402 public static final native BOOL ImageList_Draw (int /*long*/ himl, int i, int /*long*/ hdcDst, int x, int y, int fStyle);
3403 public static final native void ImageList_EndDrag (); 3403 public static final native void ImageList_EndDrag ();
3404 public static final native int /*long*/ ImageList_GetDragImage (POINT ppt, POINT pptHotspot); 3404 public static final native int /*long*/ ImageList_GetDragImage (POINT ppt, POINT pptHotspot);
3405 public static final native int /*long*/ ImageList_GetIcon (int /*long*/ himl, int i, int flags); 3405 public static final native int /*long*/ ImageList_GetIcon (int /*long*/ himl, int i, int flags);
3406 public static final native BOOL ImageList_GetIconSize (int /*long*/ himl, int [] cx, int [] cy); 3406 public static final native BOOL ImageList_GetIconSize (int /*long*/ himl, int [] cx, int [] cy);
3407 public static final native int ImageList_GetImageCount (int /*long*/ himl); 3407 public static final native int ImageList_GetImageCount (int /*long*/ himl);
3408 public static final native BOOL ImageList_Remove (int /*long*/ himl, int i); 3408 public static final native BOOL ImageList_Remove (int /*long*/ himl, int i);
3409 public static final native BOOL ImageList_Replace (int /*long*/ himl, int i, int /*long*/ hbmImage, int /*long*/ hbmMask); 3409 public static final native BOOL ImageList_Replace (int /*long*/ himl, int i, int /*long*/ hbmImage, int /*long*/ hbmMask);
3410 public static final native int ImageList_ReplaceIcon (int /*long*/ himl, int i, int /*long*/ hicon); 3410 public static final native int ImageList_ReplaceIcon (int /*long*/ himl, int i, int /*long*/ hicon);
3411 public static final native BOOL ImageList_SetIconSize (int /*long*/ himl, int cx, int cy); 3411 public static final native BOOL ImageList_SetIconSize (int /*long*/ himl, int cx, int cy);
3589 public static final native int RegEnumKeyExA (int /*long*/ hKey, int dwIndex, byte [] lpName, int [] lpcName, int [] lpReserved, byte [] lpClass, int [] lpcClass, FILETIME lpftLastWriteTime); 3589 public static final native int RegEnumKeyExA (int /*long*/ hKey, int dwIndex, byte [] lpName, int [] lpcName, int [] lpReserved, byte [] lpClass, int [] lpcClass, FILETIME lpftLastWriteTime);
3590 public static final native int RegisterClassW (WNDCLASS lpWndClass); 3590 public static final native int RegisterClassW (WNDCLASS lpWndClass);
3591 public static final native int RegisterClassA (WNDCLASS lpWndClass); 3591 public static final native int RegisterClassA (WNDCLASS lpWndClass);
3592 public static final native int RegisterWindowMessageW (char [] lpString); 3592 public static final native int RegisterWindowMessageW (char [] lpString);
3593 public static final native int RegisterWindowMessageA (byte [] lpString); 3593 public static final native int RegisterWindowMessageA (byte [] lpString);
3594 public static final native int RegisterClipboardFormatA (byte[] lpszFormat); 3594 public static final native int RegisterClipboardFormatA (byte[] lpszFormat);
3595 public static final native int RegisterClipboardFormatW (char[] lpszFormat); 3595 public static final native int RegisterClipboardFormatW (char[] lpszFormat);
3596 public static final native int RegOpenKeyExW (int /*long*/ hKey, char[] lpSubKey, int ulOptions, int samDesired, int /*long*/[] phkResult); 3596 public static final native int RegOpenKeyExW (int /*long*/ hKey, char[] lpSubKey, int ulOptions, int samDesired, int /*long*/[] phkResult);
3597 public static final native int RegOpenKeyExA (int /*long*/ hKey, byte[] lpSubKey, int ulOptions, int samDesired, int /*long*/[] phkResult); 3597 public static final native int RegOpenKeyExA (int /*long*/ hKey, byte[] lpSubKey, int ulOptions, int samDesired, int /*long*/[] phkResult);
3598 public static final native int RegQueryInfoKeyW (int /*long*/ hKey, int /*long*/ lpClass, int[] lpcbClass, int /*long*/ lpReserved, int[] lpSubKeys, int[] lpcbMaxSubKeyLen, int[] lpcbMaxClassLen, int[] lpcValues, int[] lpcbMaxValueNameLen, int[] lpcbMaxValueLen, int[] lpcbSecurityDescriptor, int /*long*/ lpftLastWriteTime); 3598 public static final native int RegQueryInfoKeyW (int /*long*/ hKey, int /*long*/ lpClass, int[] lpcbClass, int /*long*/ lpReserved, int[] lpSubKeys, int[] lpcbMaxSubKeyLen, int[] lpcbMaxClassLen, int[] lpcValues, int[] lpcbMaxValueNameLen, int[] lpcbMaxValueLen, int[] lpcbSecurityDescriptor, int /*long*/ lpftLastWriteTime);
3599 public static final native int RegQueryInfoKeyA (int /*long*/ hKey, int /*long*/ lpClass, int[] lpcbClass, int /*long*/ lpReserved, int[] lpSubKeys, int[] lpcbMaxSubKeyLen, int[] lpcbMaxClassLen, int[] lpcValues, int[] lpcbMaxValueNameLen, int[] lpcbMaxValueLen, int[] lpcbSecurityDescriptor, int /*long*/ lpftLastWriteTime); 3599 public static final native int RegQueryInfoKeyA (int /*long*/ hKey, int /*long*/ lpClass, int[] lpcbClass, int /*long*/ lpReserved, int[] lpSubKeys, int[] lpcbMaxSubKeyLen, int[] lpcbMaxClassLen, int[] lpcValues, int[] lpcbMaxValueNameLen, int[] lpcbMaxValueLen, int[] lpcbSecurityDescriptor, int /*long*/ lpftLastWriteTime);
3600 public static final native int RegQueryValueExW (int /*long*/ hKey, char[] lpValueName, int /*long*/ lpReserved, int[] lpType, char [] lpData, int[] lpcbData); 3600 public static final native int RegQueryValueExW (int /*long*/ hKey, char[] lpValueName, int /*long*/ lpReserved, int[] lpType, char [] lpData, int[] lpcbData);
3810 ++/ 3810 ++/
3811 3811
3812 /** Ansi/Unicode wrappers */ 3812 /** Ansi/Unicode wrappers */
3813 // Unicode/Ansi alias 3813 // Unicode/Ansi alias
3814 version(ANSI) { 3814 version(ANSI) {
3815 alias WINAPI.AddFontResourceExA AddFontResourceEx;
3815 alias WINAPI.CallWindowProcA CallWindowProc; 3816 alias WINAPI.CallWindowProcA CallWindowProc;
3816 alias WINAPI.CharLowerA CharLower; 3817 alias WINAPI.CharLowerA CharLower;
3817 alias WINAPI.CharUpperA CharUpper; 3818 alias WINAPI.CharUpperA CharUpper;
3818 alias WINAPI.ChooseColorA ChooseColor; 3819 alias WINAPI.ChooseColorA ChooseColor;
3819 alias WINAPI.ChooseFontA ChooseFont; 3820 alias WINAPI.ChooseFontA ChooseFont;
3901 alias WINAPI.SystemParametersInfoA SystemParametersInfo; 3902 alias WINAPI.SystemParametersInfoA SystemParametersInfo;
3902 alias WINAPI.TranslateAcceleratorA TranslateAccelerator; 3903 alias WINAPI.TranslateAcceleratorA TranslateAccelerator;
3903 alias WINAPI.UnregisterClassA UnregisterClass; 3904 alias WINAPI.UnregisterClassA UnregisterClass;
3904 alias WINAPI.VkKeyScanA VkKeyScan; 3905 alias WINAPI.VkKeyScanA VkKeyScan;
3905 }else{ 3906 }else{
3907 alias WINAPI.AddFontResourceExW AddFontResourceEx;
3906 alias WINAPI.CallWindowProcW CallWindowProc; 3908 alias WINAPI.CallWindowProcW CallWindowProc;
3907 alias WINAPI.CharLowerW CharLower; 3909 alias WINAPI.CharLowerW CharLower;
3908 alias WINAPI.CharUpperW CharUpper; 3910 alias WINAPI.CharUpperW CharUpper;
3909 alias WINAPI.ChooseColorW ChooseColor; 3911 alias WINAPI.ChooseColorW ChooseColor;
3910 alias WINAPI.ChooseFontW ChooseFont; 3912 alias WINAPI.ChooseFontW ChooseFont;
3992 alias WINAPI.SystemParametersInfoW SystemParametersInfo; 3994 alias WINAPI.SystemParametersInfoW SystemParametersInfo;
3993 alias WINAPI.TranslateAcceleratorW TranslateAccelerator; 3995 alias WINAPI.TranslateAcceleratorW TranslateAccelerator;
3994 alias WINAPI.UnregisterClassW UnregisterClass; 3996 alias WINAPI.UnregisterClassW UnregisterClass;
3995 alias WINAPI.VkKeyScanW VkKeyScan; 3997 alias WINAPI.VkKeyScanW VkKeyScan;
3996 } 3998 }
3997 3999
3998 4000
3999 4001
4000 4002
4001 4003
4002 4004
4003 /** All Natives */ 4005 /** All Natives */
4004 alias WINAPI.AbortDoc AbortDoc; 4006 alias WINAPI.AbortDoc AbortDoc;
4005 alias WINAPI.ActivateKeyboardLayout ActivateKeyboardLayout; 4007 alias WINAPI.ActivateKeyboardLayout ActivateKeyboardLayout;
4006 alias WINAPI.AdjustWindowRectEx AdjustWindowRectEx; 4008 alias WINAPI.AdjustWindowRectEx AdjustWindowRectEx;
4007 alias WINAPI.Arc Arc; 4009 alias WINAPI.Arc Arc;
4348 alias WINAPI.PtInRect PtInRect; 4350 alias WINAPI.PtInRect PtInRect;
4349 alias WINAPI.PtInRegion PtInRegion; 4351 alias WINAPI.PtInRegion PtInRegion;
4350 alias WINAPI.RealizePalette RealizePalette; 4352 alias WINAPI.RealizePalette RealizePalette;
4351 alias WINAPI.RectInRegion RectInRegion; 4353 alias WINAPI.RectInRegion RectInRegion;
4352 // <Shawn> Renamed : may conflict with dwt.graphics.rectangle.Rectangle 4354 // <Shawn> Renamed : may conflict with dwt.graphics.rectangle.Rectangle
4353 alias WINAPI.Rectangle _Rectangle; 4355 alias WINAPI.Rectangle _Rectangle;
4354 alias WINAPI.RedrawWindow RedrawWindow; 4356 alias WINAPI.RedrawWindow RedrawWindow;
4355 alias WINAPI.RegCloseKey RegCloseKey; 4357 alias WINAPI.RegCloseKey RegCloseKey;
4356 alias WINAPI.RegEnumKeyExA RegEnumKeyExA; 4358 alias WINAPI.RegEnumKeyExA RegEnumKeyExA;
4357 alias WINAPI.RegEnumKeyExW RegEnumKeyExW; 4359 alias WINAPI.RegEnumKeyExW RegEnumKeyExW;
4358 alias WINAPI.RegOpenKeyExA RegOpenKeyExA; 4360 alias WINAPI.RegOpenKeyExA RegOpenKeyExA;
4509 4511
4510 static int GetProfileString(char[] lpAppName, char[] lpKeyName, char[] lpDefault, out char[] lpReturnedString, int nSize ){ 4512 static int GetProfileString(char[] lpAppName, char[] lpKeyName, char[] lpDefault, out char[] lpReturnedString, int nSize ){
4511 TCHAR[] buffer = new TCHAR[nSize]; 4513 TCHAR[] buffer = new TCHAR[nSize];
4512 int result = _GetProfileString(.StrToTCHARz(lpAppName), .StrToTCHARz(lpKeyName), .StrToTCHARz(lpDefault), buffer.ptr, nSize); 4514 int result = _GetProfileString(.StrToTCHARz(lpAppName), .StrToTCHARz(lpKeyName), .StrToTCHARz(lpDefault), buffer.ptr, nSize);
4513 lpReturnedString = .TCHARzToStr(buffer.ptr); 4515 lpReturnedString = .TCHARzToStr(buffer.ptr);
4514 return result; 4516 return result;
4515 } 4517 }
4516 4518
4517 static char[] GetWindowText(HWND hwnd){ 4519 static char[] GetWindowText(HWND hwnd){
4518 assert(hwnd); 4520 assert(hwnd);
4519 int len = GetWindowTextLength(hwnd); 4521 int len = GetWindowTextLength(hwnd);
4520 if(len > 0){ 4522 if(len > 0){
4521 TCHAR[] buffer = new TCHAR[len + 1]; 4523 TCHAR[] buffer = new TCHAR[len + 1];
4522 len = _GetWindowText(hwnd, buffer.ptr, buffer.length); 4524 len = _GetWindowText(hwnd, buffer.ptr, buffer.length);
4523 return .TCHARzToStr(buffer.ptr, len); 4525 return .TCHARzToStr(buffer.ptr, len);
4529 static int GetWindowText(HWND hWnd, TCHAR* lpString, int nMaxCount) 4531 static int GetWindowText(HWND hWnd, TCHAR* lpString, int nMaxCount)
4530 { 4532 {
4531 return _GetWindowText(hWnd, lpString, nMaxCount); 4533 return _GetWindowText(hWnd, lpString, nMaxCount);
4532 } 4534 }
4533 4535
4534 // <Shawn Liu> added this method, copied from ATL : atlwin.h 4536 // <Shawn Liu> added this method, copied from ATL : atlwin.h
4535 static int CenterWindow(HWND m_hWnd, HWND hWndCenter = null) 4537 static int CenterWindow(HWND m_hWnd, HWND hWndCenter = null)
4536 { 4538 {
4537 assert(m_hWnd); 4539 assert(m_hWnd);
4538 4540
4539 // determine owner window to center against 4541 // determine owner window to center against
4540 uint dwStyle = OS.GetWindowLong(m_hWnd, OS.GWL_STYLE); 4542 uint dwStyle = OS.GetWindowLong(m_hWnd, OS.GWL_STYLE);
4541 if(hWndCenter is null) 4543 if(hWndCenter is null)
4542 { 4544 {
4543 if(dwStyle & OS.WS_CHILD) 4545 if(dwStyle & OS.WS_CHILD)
4552 RECT rcArea; 4554 RECT rcArea;
4553 RECT rcCenter; 4555 RECT rcCenter;
4554 HWND hWndParent; 4556 HWND hWndParent;
4555 if(!(dwStyle & OS.WS_CHILD)) 4557 if(!(dwStyle & OS.WS_CHILD))
4556 { 4558 {
4557 // don't center against invisible or minimized WINAPI 4559 // don't center against invisible or minimized WINAPI
4558 if(hWndCenter !is null) 4560 if(hWndCenter !is null)
4559 { 4561 {
4560 uint dwStyleCenter = OS.GetWindowLong(hWndCenter, OS.GWL_STYLE); 4562 uint dwStyleCenter = OS.GetWindowLong(hWndCenter, OS.GWL_STYLE);
4561 if(!(dwStyleCenter & OS.WS_VISIBLE) || (dwStyleCenter & OS.WS_MINIMIZE)) 4563 if(!(dwStyleCenter & OS.WS_VISIBLE) || (dwStyleCenter & OS.WS_MINIMIZE))
4562 hWndCenter = null; 4564 hWndCenter = null;
4599 else if(yTop + DlgHeight > rcArea.bottom) 4601 else if(yTop + DlgHeight > rcArea.bottom)
4600 yTop = rcArea.bottom - DlgHeight; 4602 yTop = rcArea.bottom - DlgHeight;
4601 4603
4602 // map screen coordinates to child coordinates 4604 // map screen coordinates to child coordinates
4603 return OS.SetWindowPos(m_hWnd, null, xLeft, yTop, -1, -1, 4605 return OS.SetWindowPos(m_hWnd, null, xLeft, yTop, -1, -1,
4604 OS.SWP_NOSIZE | OS.SWP_NOZORDER | OS.SWP_NOACTIVATE); 4606 OS.SWP_NOSIZE | OS.SWP_NOZORDER | OS.SWP_NOACTIVATE);
4605 } 4607 }
4606 4608
4607 static int OleInitialize(LPVOID reserved = null){ 4609 static int OleInitialize(LPVOID reserved = null){
4608 return WINAPI.OleInitialize(reserved); 4610 return WINAPI.OleInitialize(reserved);
4609 } 4611 }
4612 WINAPI.OleUninitialize(); 4614 WINAPI.OleUninitialize();
4613 } 4615 }
4614 4616
4615 } // END of OS 4617 } // END of OS
4616 4618
4617 private import tango.sys.win32.CodePage; 4619 private import tango_sys_win32.CodePage;
4618 private import tango.text.convert.Utf; 4620 private import tango.text.convert.Utf;
4619 private import tango.stdc.stringz; 4621 private import tango.stdc.stringz;
4620 4622
4621 // convert UTF-8 to MBCS 4623 // convert UTF-8 to MBCS
4622 alias StrToMBCS StrToMBCSs; 4624 alias StrToMBCS StrToMBCSs;
4623 public char[] StrToMBCS(char[] sc, uint codepage = 0) { 4625 public char[] StrToMBCS(char[] sc, uint codepage = 0) {
4624 char[] ret = sc; 4626 char[] ret = sc;
4625 try{ 4627 try{
4626 foreach (char c; sc){ 4628 foreach (char c; sc){
4627 if (c >= 0x80) 4629 if (c >= 0x80)
4628 { 4630 {
4629 char[] result; 4631 char[] result;
4630 int i; 4632 int i;
4631 wchar[] ws = .toString16(sc); 4633 wchar[] ws = .toString16(sc);
4632 result.length = OS.WideCharToMultiByte(codepage, 0, ws.ptr, ws.length, null, 0, null, null); 4634 result.length = OS.WideCharToMultiByte(codepage, 0, ws.ptr, ws.length, null, 0, null, null);
4633 i = OS.WideCharToMultiByte(codepage, 0, ws.ptr, ws.length, result.ptr, result.length, null, null); 4635 i = OS.WideCharToMultiByte(codepage, 0, ws.ptr, ws.length, result.ptr, result.length, null, null);
4649 if( CodePage.isAscii( sc )){ 4651 if( CodePage.isAscii( sc )){
4650 return .toStringz( sc ); 4652 return .toStringz( sc );
4651 } 4653 }
4652 char[] dst; 4654 char[] dst;
4653 dst.length = sc.length; 4655 dst.length = sc.length;
4654 return toStringz( tango.sys.win32.CodePage.CodePage.into( sc, dst )); 4656 return toStringz( tango_sys_win32.CodePage.CodePage.into( sc, dst ));
4655 }catch(Exception e){ 4657 }catch(Exception e){
4656 // do nothing 4658 // do nothing
4657 ret = ""; 4659 ret = "";
4658 } 4660 }
4659 4661
4664 wchar[] ret; 4666 wchar[] ret;
4665 try{ 4667 try{
4666 ret = toString16(sc); 4668 ret = toString16(sc);
4667 }catch(Exception e){ 4669 }catch(Exception e){
4668 // do nothing 4670 // do nothing
4669 ret = ""; 4671 ret = "";
4670 } 4672 }
4671 4673
4672 return ret; 4674 return ret;
4673 } 4675 }
4674 4676
4683 public char[] MBCSzToStr(char* pString, int _length = -1, uint codepage = 0) { 4685 public char[] MBCSzToStr(char* pString, int _length = -1, uint codepage = 0) {
4684 // null terminated string pointer 4686 // null terminated string pointer
4685 if(_length == -1){ 4687 if(_length == -1){
4686 _length = 0; 4688 _length = 0;
4687 while(*(pString + _length)) 4689 while(*(pString + _length))
4688 ++_length; 4690 ++_length;
4689 } 4691 }
4690 // convert MBCS to UTF-8 4692 // convert MBCS to UTF-8
4691 if(_length == 0) 4693 if(_length == 0)
4692 return null; 4694 return null;
4693 4695
4694 wchar[] wcs = _mbcszToWs(pString, _length, codepage); 4696 wchar[] wcs = _mbcszToWs(pString, _length, codepage);
4695 char[] result; 4697 char[] result;
4696 try{ 4698 try{
4697 result = .toString(wcs); 4699 result = .toString(wcs);
4698 }catch(Exception e){ 4700 }catch(Exception e){
4699 } 4701 }
4700 return result; 4702 return result;
4701 } 4703 }
4702 4704
4708 { 4710 {
4709 // null terminated string pointer 4711 // null terminated string pointer
4710 if(_length == -1){ 4712 if(_length == -1){
4711 _length = 0; 4713 _length = 0;
4712 while(*(pString + _length)) 4714 while(*(pString + _length))
4713 ++_length; 4715 ++_length;
4714 } 4716 }
4715 if(_length == 0) 4717 if(_length == 0)
4716 return null; 4718 return null;
4717 // convert wchar* to UTF-8 4719 // convert wchar* to UTF-8
4718 wchar[] wcs = pString[0.._length]; 4720 wchar[] wcs = pString[0.._length];
4719 4721
4720 char[] result; 4722 char[] result;
4721 try{ 4723 try{
4722 result = .toString(wcs); 4724 result = .toString(wcs);
4723 }catch(Exception e){ 4725 }catch(Exception e){
4724 // do nothing 4726 // do nothing
4725 } 4727 }
4726 return result; 4728 return result;
4727 } 4729 }
4728 4730
4729 /** 4731 /**
4730 * <Shawn> difference between WCHARzToStr(pwstr, -1) : 4732 * <Shawn> difference between WCHARzToStr(pwstr, -1) :
4731 * BSTRToStr() internally call WCHARzToStr(pwstr, length) with length set, 4733 * BSTRToStr() internally call WCHARzToStr(pwstr, length) with length set,
4732 * instead to determine the null ended, this mean BSTRToStr() can get string 4734 * instead to determine the null ended, this mean BSTRToStr() can get string
4733 * which has embedded null characters. 4735 * which has embedded null characters.
4734 */ 4736 */
4735 4737
4736 version(OLE_COM) 4738 version(OLE_COM)
4737 { 4739 {
4738 // BSTR is aliased to wchar* 4740 // BSTR is aliased to wchar*
4739 // Note : Free the "bstr" memory if freeTheString is true, default false 4741 // Note : Free the "bstr" memory if freeTheString is true, default false
4740 static char[] BSTRToStr(/*BSTR*/ inout wchar* bstr, bool freeTheString = false){ 4742 static char[] BSTRToStr(/*BSTR*/ inout wchar* bstr, bool freeTheString = false){
4741 if(bstr is null) return null; 4743 if(bstr is null) return null;
4742 int size = (SysStringByteLen(bstr) + 1)/wchar.sizeof; 4744 int size = (SysStringByteLen(bstr) + 1)/wchar.sizeof;
4743 char[] result = WCHARzToStr(bstr, size); 4745 char[] result = WCHARzToStr(bstr, size);
4752 4754
4753 4755
4754 public static wchar[] _mbcszToWs(char* pMBCS, int len, uint codepage = 0) 4756 public static wchar[] _mbcszToWs(char* pMBCS, int len, uint codepage = 0)
4755 { 4757 {
4756 wchar[] wbuf; 4758 wchar[] wbuf;
4757 // Convert MBCS to unicode 4759 // Convert MBCS to unicode
4758 wbuf.length = OS.MultiByteToWideChar(codepage, 0, pMBCS, len, null, 0); 4760 wbuf.length = OS.MultiByteToWideChar(codepage, 0, pMBCS, len, null, 0);
4759 int n = OS.MultiByteToWideChar(codepage, 0, pMBCS, len, wbuf.ptr, wbuf.length); 4761 int n = OS.MultiByteToWideChar(codepage, 0, pMBCS, len, wbuf.ptr, wbuf.length);
4760 assert(n == wbuf.length); 4762 assert(n == wbuf.length);
4761 return wbuf; 4763 return wbuf;
4762 } 4764 }
4763 4765
4764 // static methods 4766 // static methods
4765 public int _tcslen(TCHAR* pString){ 4767 public int _tcslen(TCHAR* pString){
4766 int _length = 0; 4768 int _length = 0;
4767 while(*(pString + _length)) 4769 while(*(pString + _length))
4768 ++_length; 4770 ++_length;
4769 4771
4770 return _length; 4772 return _length;
4771 } 4773 }
4772 4774
4773 /** 4775 /**
4774 * There is a bug in Phobos std.string.toupper() to lower() with 4776 * There is a bug in Phobos std.string.toupper() to lower() with
4775 std.string.toupper() and std.string.tolower() give a wrong result when deal with a mixture of upper/lower English and Chinese characters. e.g. 4777 std.string.toupper() and std.string.tolower() give a wrong result when deal with a mixture of upper/lower English and Chinese characters. e.g.
4776 char[] a = "AbCd中文eFgH"; 4778 char[] a = "AbCd中文eFgH";
4777 char[] b = std.string.toupper(a); 4779 char[] b = std.string.toupper(a);
4778 char[] c = std.string.tolower(a); 4780 char[] c = std.string.tolower(a);
4779 The length of a is 11, but the length of b,c is 18 now. 4781 The length of a is 11, but the length of b,c is 18 now.
4787 public char[] toupper(char[] string) { 4789 public char[] toupper(char[] string) {
4788 TCHAR* ps = StrToTCHARz(string); 4790 TCHAR* ps = StrToTCHARz(string);
4789 TCHAR* ps2 = OS.CharUpper(ps); 4791 TCHAR* ps2 = OS.CharUpper(ps);
4790 return TCHARzToStr(ps2); 4792 return TCHARzToStr(ps2);
4791 } 4793 }
4792 4794
4793 version(ANSI){ 4795 version(ANSI){
4794 alias StrToMBCS StrToTCHARs; 4796 alias StrToMBCS StrToTCHARs;
4795 alias StrToMBCSz StrToTCHARz; 4797 alias StrToMBCSz StrToTCHARz;
4796 alias MBCSzToStr TCHARzToStr; 4798 alias MBCSzToStr TCHARzToStr;
4797 alias MBCSsToStr TCHARsToStr; 4799 alias MBCSsToStr TCHARsToStr;