giffer

Create .gif images from sites like youtube.com
Log | Files | Refs | LICENSE

commit f6ab7371850c542dec0883eb06d4057355bda24c
parent 7743062adc4d9273c6efe823d2073a26e77204ba
Author: Jack Mordaunt <jackmordaunt@gmail.com>
Date:   Tue, 27 Nov 2018 12:39:27 -0800

[+] Hide console on Windows.

Diffstat:
Acmd/desktop/webview_windows.go | 50++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 50 insertions(+), 0 deletions(-)

diff --git a/cmd/desktop/webview_windows.go b/cmd/desktop/webview_windows.go @@ -0,0 +1,50 @@ +package main + +import ( + "github.com/gonutz/ide/w32" +) + +// Variables to be set via -ldflags -X for Windows standalone binary. +var ( + ffmpegX string + tmpX string + logfileX string +) + +func init() { + // hideConsole() + if ffmpegX != "" { + ffmpeg = ffmpegX + } + if tmpX != "" { + tmp = tmpX + } + if logfileX != "" { + logfile = logfileX + } + verbose = true +} + +// hideConsole hides the console if -H windowsgui is not specified. +// Since with "-H windowsgui" all subprocesses launched also receive windows. +// This results in several blank console windows open when executing ffmepg +// commands. +// +// Note: there is a delay, so you will see the console window briefly on startup +// before it disappears. +func hideConsole() { + console := w32.GetConsoleWindow() + if console == 0 { + return // no console attached + } + // If this application is the process that created the console window, then + // this program was not compiled with the -H=windowsgui flag and on start-up + // it created a console along with the main application window. In this case + // hide the console window. + // See + // http://stackoverflow.com/questions/9009333/how-to-check-if-the-program-is-run-from-a-console + _, consoleProcID := w32.GetWindowThreadProcessId(console) + if w32.GetCurrentProcessId() == consoleProcID { + w32.ShowWindowAsync(console, w32.SW_HIDE) + } +}