rodrigocfd / windigo

Windows API and GUI in idiomatic Go.
https://pkg.go.dev/github.com/rodrigocfd/windigo
MIT License
417 stars 23 forks source link

How to set environment variables in `CreateProcess`? #33

Open UnderCooled opened 9 months ago

UnderCooled commented 9 months ago
  proxy := readConfig()
  env := []struct {
    name string
    val string
  }{{"HTTPS_PROXY", proxy}, {"HTTP_PROXY", proxy}}

  win.CreateProcess(
    win.StrOptSome("C:\\Program Files (x86)\\AppFlowy\\AppFlowy.exe"),
    win.StrOptSome(""), &mySecurityAttr, &mySecurityAttr, true, co.CREATE_NO_WINDOW,
    env,
    win.StrOptSome("."), &myStartupInfo, &myProcessInfo)
go version go1.21.6 windows/amd64

.\appflowy_proxifier.go:59:5: cannot use env (variable of type []struct{name string; val string}) as []struct{name string; val string} value in argument to win.CreateProcess

This error is confusing.