alroyso 1 year ago
parent
commit
62bf90ed8a
1 changed files with 7 additions and 6 deletions
  1. 7 6
      windows/runner/main.cpp

+ 7 - 6
windows/runner/main.cpp

@@ -7,17 +7,18 @@
 #include <protocol_handler/protocol_handler_plugin.h>
 int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev,
                       _In_ wchar_t *command_line, _In_ int show_command) {
-  if (wcsstr(command_line, L"--runas-admin") != NULL) {
-  // 这是一个提权重启,跳过实例检测
-  } else {
-    HWND hwnd = ::FindWindow(L"FLUTTER_RUNNER_WIN32_WINDOW", L"naiyouwl");
-    if (hwnd != NULL) {
+    if (wcsstr(command_line, L"--runas-admin") != NULL) {
+
+    }
+    else {
+      HWND hwnd = ::FindWindow(L"FLUTTER_RUNNER_WIN32_WINDOW", L"naiyouwl");
+      if (hwnd != NULL) {
       DispatchToProtocolHandler(hwnd);
       ::ShowWindow(hwnd, SW_NORMAL);
       ::SetForegroundWindow(hwnd);
       return EXIT_FAILURE;
+     }
     }
-  }
 
 /*
  *