mirror of
https://github.com/rclone/rclone.git
synced 2024-11-22 15:30:06 +08:00
20 lines
463 B
Go
20 lines
463 B
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)
|
||
|
}
|
||
|
}
|
||
|
}
|