| | 272 | |
|---|
| | 273 | enableVisualStyles(); |
|---|
| | 274 | |
|---|
| | 275 | /* Make the process DPI aware for Windows Vista */ |
|---|
| | 276 | if (OS.WIN32_VERSION >= OS.VERSION (6, 0)) OS.SetProcessDPIAware (); |
|---|
| | 277 | |
|---|
| | 278 | /* Get the DBCS flag */ |
|---|
| | 279 | BOOL dbcsEnabled = OS.GetSystemMetrics (SM_DBCSENABLED) !is 0; |
|---|
| | 280 | BOOL immEnabled = OS.GetSystemMetrics (SM_IMMENABLED) !is 0; |
|---|
| | 281 | IsDBLocale = dbcsEnabled || immEnabled; |
|---|
| | 282 | |
|---|
| | 283 | /* |
|---|
| | 284 | * Bug in Windows. On Korean Windows XP when the Text |
|---|
| | 285 | * Services Framework support for legacy applications |
|---|
| | 286 | * is enabled, certain legacy calls segment fault. |
|---|
| | 287 | * For example, when ImmSetCompositionWindow() is used |
|---|
| | 288 | * to move the composition window outside of the client |
|---|
| | 289 | * area, Windows crashes. The fix is to disable legacy |
|---|
| | 290 | * support. |
|---|
| | 291 | * |
|---|
| | 292 | * Note: The bug is fixed in Service Pack 2. |
|---|
| | 293 | */ |
|---|
| | 294 | if (!OS.IsWinCE && OS.WIN32_VERSION is OS.VERSION (5, 1)) { |
|---|
| | 295 | short langID = OS.GetSystemDefaultUILanguage (); |
|---|
| | 296 | short primaryLang = OS.PRIMARYLANGID (langID); |
|---|
| | 297 | if (primaryLang is LANG_KOREAN) { |
|---|
| | 298 | OSVERSIONINFOEX infoex; |
|---|
| | 299 | infoex.dwOSVersionInfoSize = OSVERSIONINFOEX.sizeof; |
|---|
| | 300 | GetVersionEx (cast(OSVERSIONINFO*) &infoex ); |
|---|
| | 301 | if (infoex.wServicePackMajor < 2) { |
|---|
| | 302 | OS.ImmDisableTextFrameService (0); |
|---|
| | 303 | } |
|---|
| | 304 | } |
|---|
| | 305 | } |
|---|
| | 306 | |
|---|
| | 307 | /* Get the COMCTL32.DLL version */ |
|---|
| | 308 | DLLVERSIONINFO dvi; |
|---|
| | 309 | dvi.cbSize = DLLVERSIONINFO.sizeof; |
|---|
| | 310 | dvi.dwMajorVersion = 4; |
|---|
| | 311 | dvi.dwMinorVersion = 0; |
|---|
| | 312 | //PORTING_CHANGE: comctl is loaded automatically |
|---|
| | 313 | //TCHAR lpLibFileName = new TCHAR (0, "comctl32.dll", true); //$NON-NLS-1$ |
|---|
| | 314 | //int /*long*/ hModule = OS.LoadLibrary (lpLibFileName); |
|---|
| | 315 | if (auto lib = SharedLib.load( `comctl32.dll`) ) { |
|---|
| | 316 | char[] name = "DllGetVersion\0"; //$NON-NLS-1$ |
|---|
| | 317 | void* DllGetVersion = lib.getSymbol(name.ptr); |
|---|
| | 318 | if (DllGetVersion !is null){ |
|---|
| | 319 | alias extern(Windows) void function(DLLVERSIONINFO*) TDllVersion; |
|---|
| | 320 | TDllVersion f = cast( TDllVersion )DllGetVersion; |
|---|
| | 321 | f(&dvi); |
|---|
| | 322 | } |
|---|
| | 323 | lib.unload(); |
|---|
| | 324 | } |
|---|
| | 325 | COMCTL32_MAJOR = dvi.dwMajorVersion; |
|---|
| | 326 | COMCTL32_MINOR = dvi.dwMinorVersion; |
|---|
| | 327 | COMCTL32_VERSION = VERSION (COMCTL32_MAJOR, COMCTL32_MINOR); |
|---|
| | 328 | |
|---|
| | 329 | /* Get the Shell32.DLL version */ |
|---|
| | 330 | dvi = DLLVERSIONINFO.init; |
|---|
| | 331 | dvi.cbSize = DLLVERSIONINFO.sizeof; |
|---|
| | 332 | dvi.dwMajorVersion = 4; |
|---|
| | 333 | //TCHAR lpLibFileName = new TCHAR (0, "Shell32.dll", true); //$NON-NLS-1$ |
|---|
| | 334 | //int /*long*/ hModule = OS.LoadLibrary (lpLibFileName); |
|---|
| | 335 | if ( auto lib = SharedLib.load( `Shell32.dll`)) { |
|---|
| | 336 | char[] name = "DllGetVersion\0"; //$NON-NLS-1$ |
|---|
| | 337 | void* DllGetVersion = lib.getSymbol(name.ptr); |
|---|
| | 338 | if (DllGetVersion !is null){ |
|---|
| | 339 | alias extern(Windows) void function(DLLVERSIONINFO*) TDllVersion; |
|---|
| | 340 | TDllVersion f = cast( TDllVersion )DllGetVersion; |
|---|
| | 341 | f(&dvi); |
|---|
| | 342 | } |
|---|
| | 343 | lib.unload(); |
|---|
| | 344 | } |
|---|
| | 345 | SHELL32_MAJOR = dvi.dwMajorVersion; |
|---|
| | 346 | SHELL32_MINOR = dvi.dwMinorVersion; |
|---|
| | 347 | SHELL32_VERSION = VERSION (SHELL32_MAJOR, SHELL32_MINOR); |
|---|
| | 348 | } |
|---|
| | 349 | |
|---|
| | 350 | /************************************************************************** |
|---|
| | 351 | |
|---|
| | 352 | **************************************************************************/ |
|---|
| | 353 | |
|---|
| | 354 | public static void enableVisualStyles() |
|---|
| | 355 | { |
|---|
| 273 | | |
|---|
| 274 | | const char[] manifest = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?> |
|---|
| 275 | | <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> |
|---|
| 276 | | <assemblyIdentity version="1.0.0.0" processorArchitecture="X86" name="dwt" type="win32"/> |
|---|
| 277 | | <description>D Widget Toolkit</description> |
|---|
| 278 | | <dependency> |
|---|
| 279 | | <dependentAssembly> |
|---|
| 280 | | <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="X86" publicKeyToken="6595b64144ccf1df" language="*"/> |
|---|
| 281 | | </dependentAssembly> |
|---|
| 282 | | </dependency> |
|---|
| 283 | | </assembly>`; |
|---|
| | 357 | const char[] manifest = |
|---|
| | 358 | `<?xml version="1.0" encoding="UTF-8" standalone="yes"?> |
|---|
| | 359 | <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> |
|---|
| | 360 | <assemblyIdentity |
|---|
| | 361 | version="1.0.0.0" |
|---|
| | 362 | processorArchitecture="X86" |
|---|
| | 363 | name="dwt" |
|---|
| | 364 | type="win32"/> |
|---|
| | 365 | <description>D Widget Toolkit</description> |
|---|
| | 366 | <dependency> |
|---|
| | 367 | <dependentAssembly> |
|---|
| | 368 | <assemblyIdentity type="win32" |
|---|
| | 369 | name="Microsoft.Windows.Common-Controls" |
|---|
| | 370 | version="6.0.0.0" processorArchitecture="X86" |
|---|
| | 371 | publicKeyToken="6595b64144ccf1df" |
|---|
| | 372 | language="*"/> |
|---|
| | 373 | </dependentAssembly> |
|---|
| | 374 | </dependency> |
|---|
| | 375 | </assembly>`; |
|---|
| 339 | | /* Make the process DPI aware for Windows Vista */ |
|---|
| 340 | | if (OS.WIN32_VERSION >= OS.VERSION (6, 0)) OS.SetProcessDPIAware (); |
|---|
| 341 | | |
|---|
| 342 | | /* Get the DBCS flag */ |
|---|
| 343 | | BOOL dbcsEnabled = OS.GetSystemMetrics (SM_DBCSENABLED) !is 0; |
|---|
| 344 | | BOOL immEnabled = OS.GetSystemMetrics (SM_IMMENABLED) !is 0; |
|---|
| 345 | | IsDBLocale = dbcsEnabled || immEnabled; |
|---|
| 346 | | |
|---|
| 347 | | /* |
|---|
| 348 | | * Bug in Windows. On Korean Windows XP when the Text |
|---|
| 349 | | * Services Framework support for legacy applications |
|---|
| 350 | | * is enabled, certain legacy calls segment fault. |
|---|
| 351 | | * For example, when ImmSetCompositionWindow() is used |
|---|
| 352 | | * to move the composition window outside of the client |
|---|
| 353 | | * area, Windows crashes. The fix is to disable legacy |
|---|
| 354 | | * support. |
|---|
| 355 | | * |
|---|
| 356 | | * Note: The bug is fixed in Service Pack 2. |
|---|
| 357 | | */ |
|---|
| 358 | | if (!OS.IsWinCE && OS.WIN32_VERSION is OS.VERSION (5, 1)) { |
|---|
| 359 | | short langID = OS.GetSystemDefaultUILanguage (); |
|---|
| 360 | | short primaryLang = OS.PRIMARYLANGID (langID); |
|---|
| 361 | | if (primaryLang is LANG_KOREAN) { |
|---|
| 362 | | OSVERSIONINFOEX infoex; |
|---|
| 363 | | infoex.dwOSVersionInfoSize = OSVERSIONINFOEX.sizeof; |
|---|
| 364 | | GetVersionEx (cast(OSVERSIONINFO*) &infoex ); |
|---|
| 365 | | if (infoex.wServicePackMajor < 2) { |
|---|
| 366 | | OS.ImmDisableTextFrameService (0); |
|---|
| 367 | | } |
|---|
| 368 | | } |
|---|
| 369 | | } |
|---|
| 370 | | |
|---|
| 371 | | /* Get the COMCTL32.DLL version */ |
|---|
| 372 | | DLLVERSIONINFO dvi; |
|---|
| 373 | | dvi.cbSize = DLLVERSIONINFO.sizeof; |
|---|
| 374 | | dvi.dwMajorVersion = 4; |
|---|
| 375 | | dvi.dwMinorVersion = 0; |
|---|
| 376 | | //PORTING_CHANGE: comctl is loaded automatically |
|---|
| 377 | | //TCHAR lpLibFileName = new TCHAR (0, "comctl32.dll", true); //$NON-NLS-1$ |
|---|
| 378 | | //int /*long*/ hModule = OS.LoadLibrary (lpLibFileName); |
|---|
| 379 | | if (auto lib = SharedLib.load( `comctl32.dll`) ) { |
|---|
| 380 | | char[] name = "DllGetVersion\0"; //$NON-NLS-1$ |
|---|
| 381 | | void* DllGetVersion = lib.getSymbol(name.ptr); |
|---|
| 382 | | if (DllGetVersion !is null){ |
|---|
| 383 | | alias extern(Windows) void function(DLLVERSIONINFO*) TDllVersion; |
|---|
| 384 | | TDllVersion f = cast( TDllVersion )DllGetVersion; |
|---|
| 385 | | f(&dvi); |
|---|
| 386 | | } |
|---|
| 387 | | lib.unload(); |
|---|
| 388 | | } |
|---|
| 389 | | COMCTL32_MAJOR = dvi.dwMajorVersion; |
|---|
| 390 | | COMCTL32_MINOR = dvi.dwMinorVersion; |
|---|
| 391 | | COMCTL32_VERSION = VERSION (COMCTL32_MAJOR, COMCTL32_MINOR); |
|---|
| 392 | | |
|---|
| 393 | | /* Get the Shell32.DLL version */ |
|---|
| 394 | | dvi = DLLVERSIONINFO.init; |
|---|
| 395 | | dvi.cbSize = DLLVERSIONINFO.sizeof; |
|---|
| 396 | | dvi.dwMajorVersion = 4; |
|---|
| 397 | | //TCHAR lpLibFileName = new TCHAR (0, "Shell32.dll", true); //$NON-NLS-1$ |
|---|
| 398 | | //int /*long*/ hModule = OS.LoadLibrary (lpLibFileName); |
|---|
| 399 | | if ( auto lib = SharedLib.load( `Shell32.dll`)) { |
|---|
| 400 | | char[] name = "DllGetVersion\0"; //$NON-NLS-1$ |
|---|
| 401 | | void* DllGetVersion = lib.getSymbol(name.ptr); |
|---|
| 402 | | if (DllGetVersion !is null){ |
|---|
| 403 | | alias extern(Windows) void function(DLLVERSIONINFO*) TDllVersion; |
|---|
| 404 | | TDllVersion f = cast( TDllVersion )DllGetVersion; |
|---|
| 405 | | f(&dvi); |
|---|
| 406 | | } |
|---|
| 407 | | lib.unload(); |
|---|
| 408 | | } |
|---|
| 409 | | SHELL32_MAJOR = dvi.dwMajorVersion; |
|---|
| 410 | | SHELL32_MINOR = dvi.dwMinorVersion; |
|---|
| 411 | | SHELL32_VERSION = VERSION (SHELL32_MAJOR, SHELL32_MINOR); |
|---|
| 412 | | } |
|---|
| 413 | | |
|---|
| | 430 | } |
|---|
| | 431 | |
|---|
| | 432 | /************************************************************************** |
|---|
| | 433 | |
|---|
| | 434 | **************************************************************************/ |
|---|
| | 435 | |
|---|