From ab575c1e290174c518a35dce1519a81d38ba80ce Mon Sep 17 00:00:00 2001 From: Peter Repukat Date: Sat, 8 Oct 2022 20:31:42 +0200 Subject: [PATCH] Only allow single instance of GlosSITarget --- GlosSITarget/main.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/GlosSITarget/main.cpp b/GlosSITarget/main.cpp index 620eb4f..c2ae528 100644 --- a/GlosSITarget/main.cpp +++ b/GlosSITarget/main.cpp @@ -162,6 +162,13 @@ int main(int argc, char* argv[]) auto exit = 1; try { #ifdef _WIN32 + + auto existingwindow = FindWindowA(nullptr, "GlosSITarget"); + if (existingwindow) { + spdlog::error("GlosSITarget is already running!"); + return 1; + } + int numArgs; LPWSTR* args = CommandLineToArgvW(GetCommandLine(), &numArgs); std::vector argsv;