Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide Windows Console? #48

Closed
tysenmoore-xse opened this issue Apr 26, 2018 · 2 comments
Closed

Hide Windows Console? #48

tysenmoore-xse opened this issue Apr 26, 2018 · 2 comments

Comments

@tysenmoore-xse
Copy link

When running the executable from Windows the Console window is still show. I see there is a ShowWindow call that should hide the window but it is not doing the trick. I've tried this in Win10 and Win7. Is there a simple solution to this problem? Or is this known and expected?

@tysenmoore-xse
Copy link
Author

For those interested you can modify the code in systray/systray.cpp InitInstance() and replace:

ShowWindow(hWnd, nCmdShow); UpdateWindow(hWnd);

with

FreeConsole();

This will open a console very fast and close it. There may be better solutions, but this is good enough for my use case.

@tysenmoore-xse
Copy link
Author

For further reference my previously described solution works when I use go run main.go but if you build an application executable it does not work. To build the Windows version without the console window popping up you need:
go build -ldflags -Hwindowsgui main.go
(as described in https://stackoverflow.com/questions/36727740/how-to-hide-console-window-of-a-go-program-on-windows)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant