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