Checking Windows "Multiple displays" settings
-
- Enthusiast
- Posts: 443
- Joined: Sun Apr 06, 2008 12:54 pm
- Location: Brisbane, Qld, Australia
- Contact:
Checking Windows "Multiple displays" settings
Using the PB Desktop library I can determine how many screens a user has connected - provided they have set the Windows "Multiple displays" display setting to 'extend desktop to this display'. Is there an API available that will enable me to check the actual number of screens connected, and/or the "Multiple displays" display setting?
Re: Checking Windows "Multiple displays" settings
Mby this ?
Code:
or -> EnumDisplayMonitors_()
Code:
Code: Select all
Macro MonitorCount()
GetSystemMetrics_(#SM_CMONITORS)
EndMacro
Macro MonitorAreaWidth()
GetSystemMetrics_(#SM_CXVIRTUALSCREEN)
EndMacro
Macro MonitorAreaHeight()
GetSystemMetrics_(#SM_CYVIRTUALSCREEN)
EndMacro
Re: Checking Windows "Multiple displays" settings
Hi ozzie
I can not guarantee the results because I do not have such configuration
Beside I have a feeling that you can do that task using PB desktop lib
Anyhow
I can not guarantee the results because I do not have such configuration
Beside I have a feeling that you can do that task using PB desktop lib
Anyhow
Code: Select all
Structure MONITORINFOEX2 Align #PB_Structure_AlignC
cbSize.l
rcMonitor.RECT
rcWork.RECT
dwFlags.l
szDevice.c[#CCHDEVICENAME]
EndStructure
Procedure MonitorEnumProc(hMonitor, hdcMonitor, *lprcMonitor.RECT, dwData.l)
Protected m.MONITORINFOEX2, deviceName.s
Debug " Monitor Info: "
Debug " hMonitor: "+hMonitor
m\cbSize = SizeOf(m)
GetMonitorInfo_(hMonitor,@m)
deviceName = PeekS(@m\szDevice, #CCHDEVICENAME)
Debug " Primary Monitor: "+#TAB$+Bool(m\dwFlags & #MONITORINFOF_PRIMARY)
Debug " Monitor Rect: "+#TAB$+m\rcMonitor\left + "," + m\rcMonitor\top + "," + m\rcMonitor\right + "," + m\rcMonitor\bottom
Debug " Workarea Rect: "+#TAB$+m\rcWork\left + "," + m\rcWork\top + "," + m\rcWork\right + "," + m\rcWork\bottom
Debug " Device Name: "+#TAB$+deviceName
ProcedureReturn #True
EndProcedure
EnumDisplayMonitors_(0,0,@MonitorEnumProc(),0)
Code: Select all
#MONITOR_DEFAULTTONULL = 0
#MONITOR_DEFAULTTOPRIMARY = 1
#MONITOR_DEFAULTTONEAREST = 2
p.POINT
p\x = 10
p\y = 10
m.MONITORINFO
m\cbSize = SizeOf(m)
hMonitor = MonitorFromPoint_(p,#MONITOR_DEFAULTTONEAREST)
GetMonitorInfo_(hMonitor,@m)
Debug hMonitor
Debug m\rcMonitor\left
Debug m\rcMonitor\top
Debug m\rcMonitor\right
Debug m\rcMonitor\bottom
Egypt my love
-
- Enthusiast
- Posts: 443
- Joined: Sun Apr 06, 2008 12:54 pm
- Location: Brisbane, Qld, Australia
- Contact:
Re: Checking Windows "Multiple displays" settings
Thanks for the suggestions, Mijikai and RASHAD. I've run the code with my setup here and unfortunately they don't provide or let me deduce the actual number of displays connected. The Windows Display Settings appear to take effect before these functions obtain their info. Anyway, I appreciate the time you spent replying to this request.
Re: Checking Windows "Multiple displays" settings
No guarantee, either.

Code: Select all
#QDC_ALL_PATHS = $1
#QDC_ONLY_ACTIVE_PATHS = $2
#QDC_DATABASE_CURRENT = $4
Prototype.l GetDisplayConfigBufferSizes(flags.i, *numPathArrayElements, *numModeInfoArrayElements)
Global GetDisplayConfigBufferSizes.GetDisplayConfigBufferSizes
If OpenLibrary(0, "user32.dll")
GetDisplayConfigBufferSizes = GetFunction(0, "GetDisplayConfigBufferSizes")
If GetDisplayConfigBufferSizes
If GetDisplayConfigBufferSizes(#QDC_ALL_PATHS, @PathArraySize, @ModeArraySize) = #ERROR_SUCCESS
;If GetDisplayConfigBufferSizes(#QDC_DATABASE_CURRENT, @PathArraySize, @ModeArraySize) = #ERROR_SUCCESS
Debug "Total monitors = " + Str(ModeArraySize / 2)
EndIf
If GetDisplayConfigBufferSizes(#QDC_ONLY_ACTIVE_PATHS, @PathArraySize, @ModeArraySize) = #ERROR_SUCCESS
Debug "Active monitors = " + PathArraySize
EndIf
EndIf
CloseLibrary(0)
EndIf