FreeConsole

[DllImport("Kernel32.dll")][return: MarshalAs(UnmanagedType.Bool)]
public static extern bool FreeConsole(
   
);

Microsoft documentation: Linkarrow-up-right

Last updated