Example #1
0
func (mi *monitorInternal) getDefaultMonitor() {
	mi.handle = C.MonitorFromRect(nil, C.MONITOR_DEFAULTTOPRIMARY)

	info := (*C.MONITORINFO)(unsafe.Pointer(&mi.info))
	info.cbSize = C.MONITORINFOEXW_size

	C.__GetMonitorInfoW(mi.handle, &mi.info)
}
Example #2
0
func (mi *monitorInternal) isValid() bool {
	if mi.handle == nil {
		return false
	}
	info := (*C.MONITORINFO)(unsafe.Pointer(&mi.info))
	info.cbSize = C.MONITORINFOEXW_size

	return C.__GetMonitorInfoW(mi.handle, &mi.info) != 0
}