mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-02 23:51:44 +08:00
[windows] Add DPI awareness
This commit is contained in:
parent
168cd96f56
commit
0224228c46
7
v2/init.go
Normal file
7
v2/init.go
Normal file
@ -0,0 +1,7 @@
|
||||
// +build !windows
|
||||
|
||||
package wails
|
||||
|
||||
func Init() error {
|
||||
return nil
|
||||
}
|
14
v2/init_windows.go
Normal file
14
v2/init_windows.go
Normal file
@ -0,0 +1,14 @@
|
||||
package wails
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
func Init() error {
|
||||
status, r, err := syscall.NewLazyDLL("user32.dll").NewProc("SetProcessDPIAware").Call()
|
||||
if status == 0 {
|
||||
return fmt.Errorf("exit status %d: %v %v", status, r, err)
|
||||
}
|
||||
return nil
|
||||
}
|
11
v2/wails.go
11
v2/wails.go
@ -16,10 +16,17 @@ type Store = runtime.Store
|
||||
|
||||
// Run creates an application based on the given config and executes it
|
||||
func Run(options *options.App) error {
|
||||
app, err := app.CreateApp(options)
|
||||
|
||||
// Call an Init method manually
|
||||
err := Init()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return app.Run()
|
||||
mainapp, err := app.CreateApp(options)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return mainapp.Run()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user