1
mirror of https://github.com/rclone/rclone synced 2024-11-23 00:06:55 +01:00
rclone/lib/terminal/hidden_windows.go

20 lines
474 B
Go

//go: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)
}
}
}