From 4e05b2b8e8c36a4d580667808da6c0fd2a71c7cc Mon Sep 17 00:00:00 2001 From: Lea Anthony Date: Sat, 13 Aug 2022 16:42:38 +1000 Subject: [PATCH] docs: add guide to hide spawned windows --- website/docs/guides/windows.mdx | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/website/docs/guides/windows.mdx b/website/docs/guides/windows.mdx index 520f0bd8..8f183011 100644 --- a/website/docs/guides/windows.mdx +++ b/website/docs/guides/windows.mdx @@ -51,4 +51,21 @@ Also, you should specify path to fixed version of webview2 runtime in the `windo }) ``` -Note: When `WebviewBrowserPath` is specified, `error` strategy will be forced in case of minimal required version mismatch or invalid path to a runtime. \ No newline at end of file +Note: When `WebviewBrowserPath` is specified, `error` strategy will be forced in case of minimal required version +mismatch or invalid path to a runtime. + +## Spawning other programs + +When spawning other programs, such as scripts, you will see the window appear on the screen. To hide the window, +you can use the following code: + +```go +cmd := exec.Command("your_script.exe") +cmd.SysProcAttr = &syscall.SysProcAttr{ + HideWindow: true, + CreationFlags: 0x08000000, +} +cmd.Start() +``` +Solution provided by [sithembiso](https://github.com/sithembiso) on the +[discussions board](https://github.com/wailsapp/wails/discussions/1734#discussioncomment-3386172). \ No newline at end of file