golang hide window

method one

package main

import "github.com/lxn/win"

func hide(){
	win.ShowWindow(win.GetConsoleWindow(), win.SW_HIDE)
}

Method Two

package main

import "github.com/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)
}

Guess you like

Origin blog.csdn.net/u012206617/article/details/131403733