-
Notifications
You must be signed in to change notification settings - Fork 0
/
show.go
49 lines (40 loc) · 1.38 KB
/
show.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package main
import (
"fmt"
"github.com/gek64/displayController"
"syscall"
)
func showDisplayByHandle(handle int) (err error) {
var found bool = false
if len(monitors) == 0 {
return fmt.Errorf("can't find any physical display monitor")
}
for _, monitor := range monitors {
if monitor.PhysicalInfo.Handle == syscall.Handle(handle) {
found = true
showDisplay(monitor)
break
}
}
if !found {
return fmt.Errorf("can't find any physical display monitor with handle %d\n", handle)
}
return nil
}
func showAllDisplay() (err error) {
if len(monitors) == 0 {
return fmt.Errorf("can't find any physical display monitor")
} else {
fmt.Printf("Find %d Display Monitor\n", len(monitors))
}
for _, monitor := range monitors {
showDisplay(monitor)
}
return nil
}
func showDisplay(monitor displayController.CompositeMonitorInfo) {
fmt.Printf("Display Monitor Handle: %d\n", monitor.PhysicalInfo.Handle)
fmt.Printf("Display Monitor Description: %s\n", monitor.PhysicalInfo.Description)
fmt.Printf("Display Monitor Resolution: %d x %d\n", monitor.SysInfo.RectAngle.Right-monitor.SysInfo.RectAngle.Left, monitor.SysInfo.RectAngle.Bottom-monitor.SysInfo.RectAngle.Top)
fmt.Printf("Display Monitor Position: Bottom %d Top %d Right %d Left %d\n", monitor.SysInfo.RectAngle.Bottom, monitor.SysInfo.RectAngle.Top, monitor.SysInfo.RectAngle.Right, monitor.SysInfo.RectAngle.Left)
}