// Copyright 2018 The Walk Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // +build windows package walk import ( "io/ioutil" "os" "path/filepath" "strings" "syscall" "github.com/lxn/win" ) /* This function creates a manifest file for this application and activates it before creating the GUI controls. This way, the common controls version 6 is used automatically and the users of this library does not need to mess with manifest files themselves. */ func init() { appName := filepath.Base(os.Args[0]) appName = strings.TrimSuffix(appName, filepath.Ext(appName)) manifest := ` true ` // create a temporary manifest file, load it, then delete it f, err := ioutil.TempFile("", "manifest_") if err != nil { return } manifestPath := f.Name() defer os.Remove(manifestPath) f.WriteString(manifest) f.Close() ctx := win.CreateActCtx(&win.ACTCTX{ Source: syscall.StringToUTF16Ptr(manifestPath), }) win.ActivateActCtx(ctx) }