Crate hide_console

Source
Expand description

§Hide Console

A library for hiding console windows in Rust applications.

Main purpose - creating background applications or applications with graphical interface without visible console window.

§Features

  • Hiding console window on Windows platform
  • Showing console window back when needed
  • Cross-platform support (works safely on all platforms)
  • Minimal dependencies
  • Simple and clear API

§Usage Example

use hide_console::hide_console;
 
fn main() {
    // Hide console window
    hide_console();
     
    // Continue application execution...
    println!("Console is hidden, but this text will be written to stdout");
}

§Show/Hide Console Example

use hide_console::{hide_console, show_console};
use std::thread;
use std::time::Duration;
 
fn main() {
    // Hide console window
    hide_console();
     
    // Do some work without visible console
    thread::sleep(Duration::from_secs(5));
     
    // Show console when user interaction needed
    show_console();
    println!("Please check the information and press Enter to continue...");
    let mut input = String::new();
    std::io::stdin().read_line(&mut input).unwrap();
     
    // Hide console again
    hide_console();
}

§Compatibility with GUI Libraries

This library can be used with popular GUI frameworks:

use hide_console::hide_console;
 
fn main() {
    // Hide console before GUI initialization
    hide_console();
     
    // Your GUI framework initialization code goes here
    // ...
}

§Platforms

  • Windows: Full support for hiding and showing console
  • macOS, Linux and others: Functions do nothing but don’t cause errors

Functions§

hide_console
Hides the application’s console window.
is_hide_console_supported
Checks if hiding the console is supported on the current platform.
show_console
Shows the application’s console window if it was previously hidden.