Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
enumerate monitors
#2
Function GetMonitors
Code:
Copy      Help
;/
function# [ARRAY(int)&aHandles] [ARRAY(RECT)&aRectangles] [ARRAY(MONITORINFOEX)&aInfos] [int&primaryMonitorIndex]

;Gets information about display monitors.
;Returns the number of monitors.

;aHandles - if used, receives monitor handles.
;aRectangles - if used, receives monitor rectangles.
;aInfos - if used, receives monitor infos. MONITORINFOEX reference - look in MSDN.
;primaryMonitorIndex - if used, receives 0-based index of the primary monitor in the array.


if &aHandles or &aRectangles or &aInfos or &primaryMonitorIndex
,if(&aHandles) aHandles=0
,if(&aRectangles) aRectangles=0
,if(&aInfos) aInfos=0
,int i
,
,EnumDisplayMonitors 0 0 &sub.Proc 0
,
,if(&aHandles) ret aHandles.len
,if(&aRectangles) ret aRectangles.len
,if(&aInfos) ret aInfos.len

ret GetSystemMetrics(SM_CMONITORS)


#sub Proc v
function# hMonitor hdcMonitor RECT*lprcMonitor dwData

if(&aHandles) aHandles[]=hMonitor
if(&aRectangles) aRectangles[]=*lprcMonitor
if(&aInfos or &primaryMonitorIndex)
,MONITORINFOEX mi.cbSize=sizeof(MONITORINFOEX)
,GetMonitorInfo(hMonitor +&mi)
,if(&aInfos) aInfos[]=mi
,if(&primaryMonitorIndex and mi.dwFlags&MONITORINFOF_PRIMARY) primaryMonitorIndex=i
,i+1

ret 1


Messages In This Thread
enumerate monitors - by r0n - 01-28-2018, 09:35 PM
RE: enumerate monitors - by Gintaras - 01-29-2018, 07:03 AM
RE: enumerate monitors - by r0n - 01-29-2018, 02:19 PM
RE: enumerate monitors - by r0n - 01-29-2018, 03:38 PM
RE: enumerate monitors - by Gintaras - 01-29-2018, 08:49 PM
RE: enumerate monitors - by r0n - 01-29-2018, 10:09 PM
RE: enumerate monitors - by ScottF - 10-10-2020, 09:05 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)