From d3d904149ae23b3c4c49d687088897d8b5ca1e16 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Mon, 7 Nov 2022 23:31:55 +0100 Subject: [PATCH] Fix window title in reflection disabled mode --- .../Backend/Win32ApplicationRunner.cs | 11 ++++++----- samples/ComputeSharp.SwapChain/Program.cs | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/samples/ComputeSharp.SwapChain/Backend/Win32ApplicationRunner.cs b/samples/ComputeSharp.SwapChain/Backend/Win32ApplicationRunner.cs index 04a35bed..e6dd3c90 100644 --- a/samples/ComputeSharp.SwapChain/Backend/Win32ApplicationRunner.cs +++ b/samples/ComputeSharp.SwapChain/Backend/Win32ApplicationRunner.cs @@ -42,16 +42,17 @@ internal static unsafe class Win32ApplicationRunner /// and it should be called as soon as the process is launched, excluding any other additional initialization needed. /// /// The input application instance to run. - /// Name of the input application instance to run. + /// Name of the input application instance to run. + /// The title to use for the window being opened. /// The exit code for the application. - public static int Run(Win32Application application, string applicatioName) + public static int Run(Win32Application application, string applicationName, string windowTitle) { Win32ApplicationRunner.application = application; HMODULE hInstance = Windows.GetModuleHandleW(null); - fixed (char* name = applicatioName) - fixed (char* windowTitle = application.GetType().ToString()) + fixed (char* name = applicationName) + fixed (char* title = windowTitle) { // Initialize the window class WNDCLASSEXW windowClassEx = new() @@ -79,7 +80,7 @@ internal static unsafe class Win32ApplicationRunner hwnd = Windows.CreateWindowExW( 0, windowClassEx.lpszClassName, - (ushort*)windowTitle, + (ushort*)title, WS.WS_OVERLAPPEDWINDOW, Windows.CW_USEDEFAULT, Windows.CW_USEDEFAULT, diff --git a/samples/ComputeSharp.SwapChain/Program.cs b/samples/ComputeSharp.SwapChain/Program.cs index feae0e7d..faf777c3 100644 --- a/samples/ComputeSharp.SwapChain/Program.cs +++ b/samples/ComputeSharp.SwapChain/Program.cs @@ -61,7 +61,7 @@ class Program Console.WriteLine(); Console.WriteLine($"Starting {Samples[index].ShaderName}..."); - _ = Win32ApplicationRunner.Run(Samples[index].Application, "ComputeSharp.SwapChain"); + _ = Win32ApplicationRunner.Run(Samples[index].Application, "ComputeSharp.SwapChain", Samples[index].ShaderName); } } while (index >= 0 && index < Samples.Length);