Detecting multiple monitors?

BlitzMax Forums/BlitzMax Programming/Detecting multiple monitors?

I want to modify my WINDOW_CENTER MaxGUI module modification to handle multiple monitors. This would center the window in the middle of the first monitor, instead of spreading it across the two. How might I detect multiple monitors?

Ignore this, glib answer. Sorry


Popup a Diologue box, and ask.

DesktopExtension can handle multiple monitors for Windows.
The code is open to use. Download it from my signature. The magic key is EnumDisplayMonitors.


~edit~

To get the position and size of each single monitor:
Type TDisplay
	Global List:TList = New TList
	Field id:Int
	Field handle:Int
	Field x:Int
	Field y:Int
	Field width:Int
	Field height:Int
End Type

Type TRect
   Field rLeft:Int
   Field rTop:Int
   Field rRight:Int
   Field rBottom:Int
End Type
		
Extern "Win32"
	Function EnumDisplayMonitors:Int (hdc:Int, lprcClip:Byte Ptr, lpfnEnum:Byte Ptr, dwData:Byte Ptr)"Win32"
End Extern

Function MonitorEnumProc:Byte (hMonitor:Int,hdcMonitor:Int,lprcMonitor:Byte Ptr,dwData:Int)
	Local tempRect:TRect = New TRect
	MemCopy(tempRect, lprcMonitor, SizeOf(tempRect))
	Local display:TDisplay = New TDisplay
	TDisplay.List.AddLast(display)
	display.id = TDisplay.List.Count()
	display.handle = hMonitor
	display.x = tempRect.rLeft
	display.y = tempRect.rTop
	display.width = tempRect.rRight - display.x
	display.height = tempRect.rBottom - display.y
	Return True
End Function
EnumDisplayMonitors (Null,Null,MonitorEnumProc,Null)

This will fill the TDisplay type with information about your monitors. Each monitor has it's own TDisplay type, stored in TDisplay.List

To get the full Desktop size (all monitors) do the following:

Extern "Win32"
	Function GetSystemMetrics:Int (nIndex:Int)"Win32"
End Extern

Const SM_CXVIRTUALSCREEN:Int = 78
Const SM_CYVIRTUALSCREEN:Int = 79

Local fullwidth:int = GetSystemMetrics(SM_CXVIRTUALSCREEN)
Local fullheight:int = GetSystemMetrics(SM_CYVIRTUALSCREEN)


To get the amount of your systems monitors:
Extern "Win32"
	Function GetSystemMetrics:Int (nIndex:Int)"Win32"
End Extern

Const SM_CMONITORS:Int = 80

Local amount:int = GetSystemMetrics(SM_CMONITORS)


To make sure all monitors has the same depth:
Extern "Win32"
	Function GetSystemMetrics:Int (nIndex:Int)"Win32"
End Extern

Const SM_SAMEDISPLAYFORMAT:Int = 81

Local IsSameDepth:int = GetSystemMetrics(SM_SAMEDISPLAYFORMAT)


I hope this would help you out...

cheers