需求
windiws执行golang代码时,会弹出命令对话框
执行时应去掉或隐藏命令对话框
方法一
package main
import "/lxn/win"
func hide(){
win.ShowWindow(win.GetConsoleWindow(), win.SW_HIDE)
}
方法二
package main
import "/gonutz/ide/w32"
func ShowConsoleAsync(commandShow uintptr) {
console := w32.GetConsoleWindow()
if console != 0 {
_, consoleProcID := w32.GetWindowThreadProcessId(console)
if w32.GetCurrentProcessId() == consoleProcID {
w32.ShowWindowAsync(console, commandShow)
}
}
}
func main() {
ShowConsoleAsync(w32.SW_HIDE)
}