| Crates.io | hide_console |
| lib.rs | hide_console |
| version | 0.2.1 |
| created_at | 2025-03-02 11:31:57.337162+00 |
| updated_at | 2025-03-02 15:45:38.29523+00 |
| description | A library for hiding console windows in Rust applications |
| homepage | |
| repository | https://github.com/ml0ccy/hide_console |
| max_upload_size | |
| id | 1574525 |
| size | 29,798 |
A library for hiding console windows in Rust applications. Perfect for creating background applications or applications with graphical interface without visible console window.
Full documentation is available at docs.rs/hide_console.
Add to your Cargo.toml:
[dependencies]
hide_console = "0.2.1"
Or use the command:
cargo add hide_console
use hide_console::hide_console;
fn main() {
// Perform necessary actions before hiding the console
println!("This message will be visible");
// Hide the console window
hide_console();
// Continue program execution without visible console
println!("This message won't be visible in the console, but will be written to stdout");
}
use hide_console::{hide_console, show_console};
use std::io;
fn main() {
// Hide console at application start
hide_console();
// Do some work without visible console
// When user interaction is needed, show console again
show_console();
println!("Please enter your name:");
let mut name = String::new();
io::stdin().read_line(&mut name).expect("Failed to read input");
println!("Hello, {}!", name.trim());
// Hide console again for background work
hide_console();
}
use hide_console::is_hide_console_supported;
fn main() {
if is_hide_console_supported() {
println!("Console hiding is supported on this platform");
} else {
println!("Console hiding is not supported on this platform");
}
}
The library contains several examples that you can run:
# Simple console hiding example
cargo run --example simple
# GUI application emulation
cargo run --example gui_emulation
# Toggle console visibility
cargo run --example toggle_console
On Windows platform, the library uses WinAPI to hide and show the console window:
GetConsoleWindow()ShowWindow() with the SW_HIDE or SW_SHOW parameterOn other platforms, the functions simply return without performing any actions.
MIT
Contributions are welcome! Please submit pull requests or create issues on GitHub.
twitch.tv/mloccy_
t.me/mloccy