mirror of
https://github.com/octoleo/syncthing.git
synced 2024-12-23 03:18:59 +00:00
3d8b4a42b7
GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4228
23 lines
639 B
Go
23 lines
639 B
Go
// Copyright (C) 2014 The Syncthing Authors.
|
|
//
|
|
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
// License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
// You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
|
|
// +build windows
|
|
|
|
package osutil
|
|
|
|
import "syscall"
|
|
|
|
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)
|
|
}
|
|
}
|
|
}
|