导入包
import "github.com/gonutz/ide/w32"
//隐藏console
func HideConsole(){
    ShowConsoleAsync(w32.SW_HIDE)
}
//显示console
func ShowConsole(){
ShowConsoleAsync(w32.SW_SHOW)
}
//
func ShowConsoleAsync(commandShow uintptr){
console := w32.GetConsoleWindow()
if console != 0 {
_, consoleProcID := w32.GetWindowThreadProcessId(console)
if w32.GetCurrentProcessId() == consoleProcID {
w32.ShowWindowAsync(console, commandShow)
}
}
}
引用链接: https://stackoverflow.com/questions/23250505/how-do-i-create-an-executable-from-golang-that-doesnt-open-a-command-cmd-wind
05-23 05:37