github.com/secoba/wails/v2@v2.6.4/internal/frontend/desktop/windows/winc/w32/shcore.go (about)

     1  //go:build windows
     2  
     3  package w32
     4  
     5  import (
     6  	"syscall"
     7  	"unsafe"
     8  )
     9  
    10  var (
    11  	modshcore = syscall.NewLazyDLL("shcore.dll")
    12  
    13  	procGetDpiForMonitor = modshcore.NewProc("GetDpiForMonitor")
    14  )
    15  
    16  func HasGetDPIForMonitorFunc() bool {
    17  	err := procGetDpiForMonitor.Find()
    18  	return err == nil
    19  }
    20  
    21  func GetDPIForMonitor(hmonitor HMONITOR, dpiType MONITOR_DPI_TYPE, dpiX *UINT, dpiY *UINT) uintptr {
    22  	ret, _, _ := procGetDpiForMonitor.Call(
    23  		hmonitor,
    24  		uintptr(dpiType),
    25  		uintptr(unsafe.Pointer(dpiX)),
    26  		uintptr(unsafe.Pointer(dpiY)))
    27  
    28  	return ret
    29  }