Is there any way to show/hide the game window on demand?

Short story:

I’m making a game with a level editor, the game itself is made in Unity, the Editor is made in WPF.

When the Editor is opened, the game establishes a TCP connection with the editor, and displays a blank scene with some GUIText with information about the connection.

I would like to hide the game window entirely, when the editor is in use, but i need to keep the game running in background so when people click “Test Level” in the editor, the level is started inmediatly, without having to wait the game to initialize and stuff.

Is there any way to hide and show the Game Window on demand?

Sure !

using System;
 using UnityEngine;
 using System.Runtime.InteropServices;
 
 public class HideUnityWindow : MonoBehaviour
 {
     [DllImport("user32.dll")]
     private static extern IntPtr GetActiveWindow();
 
     [DllImport("user32.dll")]
     static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
 
     const int SW_HIDE = 0;
 
     void Start()
     {
         var hwnd = GetActiveWindow();
         ShowWindow(hwnd, SW_HIDE);
 
     }
  
 }

Is there a way to show the window after u hide it? @OliverJackman
I tried the SW_RESTORE and the other SW Stuff, nothing worked D: