| Crates.io | hide_console_ng |
| lib.rs | hide_console_ng |
| version | 0.1.0 |
| created_at | 2025-11-19 22:26:27.499364+00 |
| updated_at | 2025-11-19 22:26:27.499364+00 |
| description | Hide console on windows for runtime multi-subsystem applications |
| homepage | |
| repository | https://github.com/Skrity/hide_console_ng |
| max_upload_size | |
| id | 1940855 |
| size | 15,313 |
This is a zero-dependency (implicitly depends on win32 via windows-bindgen) library to achieve multi-subsystem single executable programs on Windows.
If used in a #![windows_subsystem = "windows"] environment, the console is not attached, so this won't do anything
| windows_subsystem = "windows" | windows_subsystem = "windows & AllocConsole | windows_subsystem = "windows" & AttachConsole | windows_subsystem = "console" & ShowWindow(SW_HIDE) | |
|---|---|---|---|---|
| runtime selection | ❌ | ✅ | ✅ | ✅ |
| console doesn't flash at startup | ✅ | ✅ | ✅ | ❌ |
| keeps parent's console and stdin/stdout | ❌(detached) | ❌* | ✅** | ✅ |
* new console is created outside of terminal application ** will attach stdin/stdout, but the console is not owned by our process
The method used in this library will flash a console for a brief period, but otherwise this will allow you to create an application with both GUI and CLI codepaths.
cargo doc --target x86_64-pc-windows-gnu
Add the library:
[target.'cfg(windows)'.dependencies]
hide_console_ng = "0"
// Optionally specify at the top of "main.rs" ("console" is default)
#![windows_subsystem = "console"]
let is_gui = true; // parse arguments and determine console/windowed mode
if (is_gui) {
#[cfg(windows)]
hide_console_ng::hide_console();
}
// continue with your application