Skip to content
This repository has been archived by the owner on Aug 23, 2019. It is now read-only.

Commit

Permalink
add shcore
Browse files Browse the repository at this point in the history
  • Loading branch information
shelllet committed Jul 25, 2019
1 parent 542e7ed commit ef13a8a
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
22 changes: 22 additions & 0 deletions constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -3026,3 +3026,25 @@ const (
ALPC_SYNC_OBJECT_TYPE uint32 = 2
ALPC_THREAD_OBJECT_TYPE uint32 = 4
)

// Device scale factor
// https://docs.microsoft.com/zh-cn/windows/win32/api/shtypes/ne-shtypes-device_scale_factor
const (
DEVICE_SCALE_FACTOR_INVALID = 0
SCALE_100_PERCENT = 100
SCALE_120_PERCENT = 120
SCALE_125_PERCENT = 125
SCALE_140_PERCENT = 140
SCALE_150_PERCENT = 150
SCALE_160_PERCENT = 160
SCALE_175_PERCENT = 175
SCALE_180_PERCENT = 180
SCALE_200_PERCENT = 200
SCALE_225_PERCENT = 225
SCALE_250_PERCENT = 250
SCALE_300_PERCENT = 300
SCALE_350_PERCENT = 350
SCALE_400_PERCENT = 400
SCALE_450_PERCENT = 450
SCALE_500_PERCENT = 500
)
24 changes: 24 additions & 0 deletions shcore.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright 2010-2012 The W32 Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package w32

import (
"syscall"
"unsafe"
)

var (
modshcore = syscall.NewLazyDLL("Shcore.dll")

getScaleFactorForMonitor = modshcore.NewProc("GetScaleFactorForMonitor")
)

func GetScaleFactorForMonitor(hMonitor HMONITOR, scale *int) HRESULT {
ret, _, _ := getScaleFactorForMonitor.Call(
uintptr(hMonitor),
uintptr(unsafe.Pointer(scale)))

return HRESULT(ret)
}

0 comments on commit ef13a8a

Please sign in to comment.