diff dwt/internal/win32/OS.d @ 108:6f75fdfa1bcd

Change LRESULT to class, like done in the old DWT.
author Frank Benoit <benoit@tionex.de>
date Mon, 11 Feb 2008 02:44:32 +0100
parents e4a62cdcd2e0
children e3b3f0fc0c7b
line wrap: on
line diff
--- a/dwt/internal/win32/OS.d	Mon Feb 11 00:56:33 2008 +0100
+++ b/dwt/internal/win32/OS.d	Mon Feb 11 02:44:32 2008 +0100
@@ -67,6 +67,13 @@
 
 */
 
+public class LDWTRESULT {
+    public int value;
+    // initalize ONE and ZERO in static OS.this();
+    public static LDWTRESULT ONE;
+    public static LDWTRESULT ZERO;
+    public this (int value) { this.value = value; }
+}
 
 
 public class OS : C {
@@ -194,6 +201,8 @@
 
     /* Get the Windows version and the flags */
     public static this() {
+        LDWTRESULT.ONE = new LDWTRESULT(1);
+        LDWTRESULT.ZERO = new LDWTRESULT(0);
         /*
         * Try the UNICODE version of GetVersionEx first
         * and then the ANSI version.  The UNICODE version
@@ -261,57 +270,57 @@
         //PORTING_CHANGE: made by version
         //IsUnicode = !IsWin32s && !IsWin95;
         /* Load the manifest to force the XP Theme */
-
-		ULONG_PTR ulpActivationCookie;
-		ACTCTX actctx;
-		HANDLE hActCtx = INVALID_HANDLE_VALUE;
-		DWORD dwLastError;
-		
-		tango.io.TempFile.TempFile.Style style = {tango.io.TempFile.TempFile.Transience.Transient};
-		
-		scope File file;
-		scope temp = new tango.io.TempFile.TempFile(style);
-		scope filePath = temp.path;
-		
-		const char[] filename = "dwt.manifest";
-		const char[] manifest = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-								<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
-									<assemblyIdentity version="1.0.0.0" processorArchitecture="X86" name="dwt" type="win32"/>
-									<description>D Widget Toolkit</description>
-									<dependency>
-										<dependentAssembly>
-											<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="X86" publicKeyToken="6595b64144ccf1df" language="*"/>
-										</dependentAssembly>
-									</dependency>
-								</assembly>`;
-		
-		filePath.file = filename;
-		
-		if (!filePath.exists)
-		{
-			file = new File(filePath.toString);
-			file.write(manifest);
-		}
-		
-		memset(&actctx, 0, actctx.sizeof);
-		actctx.cbSize = actctx.sizeof;
-		actctx.lpSource = toString16(filePath.toString).toString16z();
-		
-		// Create the activation context, then delete the string - we don't need it
-		// anymore.
-		hActCtx = OS.CreateActCtx(&actctx);
-		
-		// Did we fail creating the activation context?
-		if (hActCtx == INVALID_HANDLE_VALUE)
-			Trace.formatln("The Activation Context could not be created");
-		
-		// Activate the context and make use of it
-		if (!OS.ActivateActCtx(hActCtx, &ulpActivationCookie))
-			Trace.formatln("The Activation Context failed to load");
+        if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (5, 1)) {
+
+            ULONG_PTR ulpActivationCookie;
+            ACTCTX actctx;
+            HANDLE hActCtx = INVALID_HANDLE_VALUE;
+            DWORD dwLastError;
+
+            tango.io.TempFile.TempFile.Style style = {tango.io.TempFile.TempFile.Transience.Transient};
+
+            scope File file;
+            scope temp = new tango.io.TempFile.TempFile(style);
+            scope filePath = temp.path;
+
+            const char[] filename = "dwt.manifest";
+            const char[] manifest = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+                                    <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+                                        <assemblyIdentity version="1.0.0.0" processorArchitecture="X86" name="dwt" type="win32"/>
+                                        <description>D Widget Toolkit</description>
+                                        <dependency>
+                                            <dependentAssembly>
+                                                <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="X86" publicKeyToken="6595b64144ccf1df" language="*"/>
+                                            </dependentAssembly>
+                                        </dependency>
+                                    </assembly>`;
+
+            filePath.file = filename;
+
+            if (!filePath.exists)
+            {
+                file = new File(filePath.toString);
+                file.write(manifest);
+            }
+
+            memset(&actctx, 0, actctx.sizeof);
+            actctx.cbSize = actctx.sizeof;
+            actctx.lpSource = toString16(filePath.toString).toString16z();
+
+            // Create the activation context, then delete the string - we don't need it
+            // anymore.
+            hActCtx = OS.CreateActCtx(&actctx);
+
+            // Did we fail creating the activation context?
+            if (hActCtx == INVALID_HANDLE_VALUE)
+                Trace.formatln("The Activation Context could not be created");
+
+            // Activate the context and make use of it
+            if (!OS.ActivateActCtx(hActCtx, &ulpActivationCookie))
+                Trace.formatln("The Activation Context failed to load");
 
 
 /+         //if (System.getProperty (NO_MANIFEST) is null) {
-           if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (5, 1)) {
 trace(__LINE__);
                 TCHAR[] buffer = new TCHAR[ MAX_PATH ];
                 HANDLE hModule = OS.GetLibraryHandle ();
@@ -341,9 +350,9 @@
                 * for the entire lifetime of the program.  It is deactivated
                 * and released by Windows when the program exits.
                 */
-            }
         //}
 +/
+        }
         /* Make the process DPI aware for Windows Vista */
         if (OS.WIN32_VERSION >= OS.VERSION (6, 0)) OS.SetProcessDPIAware ();