golang隐藏/显示window系统下的黑色命令窗(hide/show console)


 

导入包
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


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM