Hide the terminal window

This commit is contained in:
Vladimir Borisov 2021-07-21 21:53:02 +03:00
parent ce2d387ac9
commit f5a6f912b4
2 changed files with 12 additions and 1 deletions

View file

@ -8,7 +8,7 @@ once_cell = "1.3.1"
native-windows-gui = { version = "1.0.4", features = ["high-dpi", "notice"] }
native-windows-derive = "1.0.3"
winapi = { version = "0.3.9", features = [
"libloaderapi", "handleapi",
"libloaderapi", "handleapi", "wincon", "winuser"
] }
webview2 = "0.1.0"
webview2-sys = "0.1.0-beta.1"

View file

@ -1,5 +1,8 @@
use native_windows_gui::{self as nwg, NativeUi};
use std::ptr;
use structopt::StructOpt;
use winapi::um::wincon::GetConsoleWindow;
use winapi::um::winuser::{ShowWindow, SW_HIDE};
mod stremio_app;
use crate::stremio_app::{stremio_server::StremioServer, MainWindow};
@ -16,6 +19,14 @@ struct Opt {
}
fn main() {
// Hide the terminal window
let window = unsafe { GetConsoleWindow() };
if window != ptr::null_mut() {
unsafe {
ShowWindow(window, SW_HIDE);
}
}
// native-windows-gui has some basic high DPI support with the high-dpi
// feature. It supports the "System DPI Awareness" mode, but not the more
// advanced Per-Monitor (v2) DPI Awareness modes.