Exemple #1
0
func main() {
	img, err := screenshot.CaptureScreen()
	if err != nil {
		panic(err)
	}
	f, err := os.Create("./ss.png")
	if err != nil {
		panic(err)
	}
	err = png.Encode(f, img)
	if err != nil {
		panic(err)
	}
	f.Close()
}
/*func onReady() {
    systray.SetIcon(icon.Data)
    systray.SetTitle("Awesome App")
    systray.SetTooltip("Pretty awesome")
    mQuit := systray.AddMenuItem("Quit", "Quit the whole app")
    go func() {
		<-mQuit.ClickedCh
		systray.Quit()
		fmt.Println("Quit now...")
	}()
}*/
func makeScreenshot() (file string, err error) {
	file = "ss123.png"
	img, err := screenshot.CaptureScreen()
	if err != nil {
		return file, err
	}
	f, err := os.Create("./" + file)
	if err != nil {
		return file, err
	}
	err = png.Encode(f, img)
	if err != nil {
		return file, err
	}
	f.Close()
	return file, nil
}