Last active
August 29, 2015 14:17
-
-
Save oakwhiz/ec1ef551f889c4db2708 to your computer and use it in GitHub Desktop.
A failed attempt to hide the console in Windows.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![feature(thread_sleep, std_misc)] | |
extern crate winapi; | |
extern crate "kernel32-sys" as kernel32; | |
extern crate "user32-sys" as user32; | |
fn main() { | |
println!("About to hide the console."); | |
sleep(1); | |
unsafe { | |
user32::ShowWindow(kernel32::GetConsoleWindow(), winapi::SW_HIDE); | |
} | |
sleep(1); | |
println!("The console has been hidden. About to restore the console."); | |
sleep(1); | |
unsafe { | |
user32::ShowWindow(kernel32::GetConsoleWindow(), winapi::SW_RESTORE); | |
} | |
sleep(1); | |
println!("The console has been restored."); | |
sleep(1); | |
} | |
fn sleep(seconds: i64) { | |
std::thread::sleep(std::time::duration::Duration::seconds(seconds)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment