diff --git a/samples/ComputeSharp.SwapChain/Backend/Win32ApplicationRunner.cs b/samples/ComputeSharp.SwapChain/Backend/Win32ApplicationRunner.cs index 9cdfe230..8d0a0c30 100644 --- a/samples/ComputeSharp.SwapChain/Backend/Win32ApplicationRunner.cs +++ b/samples/ComputeSharp.SwapChain/Backend/Win32ApplicationRunner.cs @@ -148,6 +148,12 @@ internal unsafe static class Win32ApplicationRunner { Thread.Sleep(100); } + + // Also listen to Escape and 'Q' to Quit. + if (msg.message == Windows.WM_KEYUP && (msg.wParam == Windows.VK_ESCAPE || msg.wParam == 0x51)) + { + _ = Windows.DestroyWindow(hwnd); + } } tokenSource.Cancel();