2021-09-09 12:25:25 +00:00
|
|
|
//go:build windows
|
2021-01-24 11:28:39 +00:00
|
|
|
// +build windows
|
|
|
|
|
|
|
|
package terminal
|
|
|
|
|
|
|
|
import (
|
|
|
|
"syscall"
|
|
|
|
)
|
|
|
|
|
|
|
|
// HideConsole hides the console window and activates another window
|
|
|
|
func HideConsole() {
|
|
|
|
getConsoleWindow := syscall.NewLazyDLL("kernel32.dll").NewProc("GetConsoleWindow")
|
|
|
|
showWindow := syscall.NewLazyDLL("user32.dll").NewProc("ShowWindow")
|
|
|
|
if getConsoleWindow.Find() == nil && showWindow.Find() == nil {
|
|
|
|
hwnd, _, _ := getConsoleWindow.Call()
|
|
|
|
if hwnd != 0 {
|
|
|
|
showWindow.Call(hwnd, 0)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|