From c10c4a6f891b46f6ec3e82fba04cafb4bd77d3ce Mon Sep 17 00:00:00 2001 From: bggRGjQaUbCoE Date: Wed, 15 Oct 2025 19:06:25 +0800 Subject: [PATCH] windows single instance Closes #1574 Signed-off-by: bggRGjQaUbCoE --- windows/runner/main.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/windows/runner/main.cpp b/windows/runner/main.cpp index 0288a2b7..0bd00d91 100644 --- a/windows/runner/main.cpp +++ b/windows/runner/main.cpp @@ -7,6 +7,13 @@ int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, _In_ wchar_t *command_line, _In_ int show_command) { + HWND hwnd = ::FindWindow(NULL, L"piliplus"); + if (hwnd != NULL) { + ::ShowWindow(hwnd, SW_NORMAL); + ::SetForegroundWindow(hwnd); + return EXIT_FAILURE; + } + // Attach to console when present (e.g., 'flutter run') or create a // new console when running with a debugger. if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) {