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

Use ShellExecute from golang.org/x/sys/windows #34

Merged
merged 1 commit into from Jul 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 2 additions & 4 deletions browser_windows.go
@@ -1,9 +1,7 @@
//go:generate mkwinsyscall -output zbrowser_windows.go browser_windows.go
//sys shellExecute(hwnd int, verb string, file string, args string, cwd string, showCmd int) (err error) = shell32.ShellExecuteW
package browser

const sW_SHOWNORMAL = 1
import "golang.org/x/sys/windows"

func openBrowser(url string) error {
return shellExecute(0, "", url, "", "", sW_SHOWNORMAL)
return windows.ShellExecute(0, nil, windows.StringToUTF16Ptr(url), nil, nil, windows.SW_SHOWNORMAL)
}
2 changes: 1 addition & 1 deletion go.mod
Expand Up @@ -2,4 +2,4 @@ module github.com/pkg/browser

go 1.14

require golang.org/x/sys v0.0.0-20210319071255-635bc2c9138d // indirect
require golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71
2 changes: 2 additions & 0 deletions go.sum
@@ -0,0 +1,2 @@
golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71 h1:X/2sJAybVknnUnV7AD2HdT6rm2p5BP6eH2j+igduWgk=
golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
76 changes: 0 additions & 76 deletions zbrowser_windows.go

This file was deleted.