The attached is a basic get of the allscreens property of the .NET Windows.Forms.Screens class. The data for my laptop (single screen) is returned as ARRAY type and WB can understand it, but I am not really sure of the exact way to render it readable.
This is an example of one of the reasons the 'ObjectClrType' function exists. WinBatch automagically detects return values as CLR objects and wraps them in a COM Automation object (DISPATCH variant). However, for performances reasons it doesn't wrap every element of a return array of objects so the user needs to perform the wrap.
ObjectClrOption("use","System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
Screen = ObjectClrNew('System.Windows.Forms.Screen')
Screens = Screen.AllScreens
foreach Item in Screens
ScreenItem = ObjectClrType("System.Windows.Forms.Screen", Item)
Message("Device Name", ScreenItem.DeviceName)
next
exit
The script also gets at the PrimaryDisplay which comes back as a DISPATCH. The interest is not so much in out-doing the existing WB screen functions but to get a better understanding of these return types from .NET classes.
As stated in the WinBatch documentation for the CLR functions and above, WinBatch wraps CLR based class references in COM Automation objects. If you look at the documentation for the Screen class property 'PrimaryScreen'
http://msdn.microsoft.com/en-us/library/system.windows.forms.screen.primaryscreen.aspxyou will notice that returns a class reference. WinBatch simple wraps the return in a light weight COM automation object and you can access it just like any wrapped object returned by 'OptionsClrNew'.