golang隐藏/显示window系统下的黑色命令窗(hide/show console)
程序员文章站
2022-07-02 16:22:51
导入包import "github.com/gonutz/ide/w32" //隐藏consolefunc HideConsole(){ ShowConsoleAsync(w32.SW_HIDE)}//显示consolefunc ShowConsole(){ ShowConsoleAsync(w32... ......
导入包
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://*.com/questions/23250505/how-do-i-create-an-executable-from-golang-that-doesnt-open-a-command-cmd-wind
上一篇: oracle 创建表空间详细介绍
下一篇: 偏函数