# This file is generated by zz_sysinfo_win.m

$PICode = @"
using System;
using System.Runtime.InteropServices;

namespace Resolution
{
    [StructLayout(LayoutKind.Sequential)]
    public struct DEVMODE1
    {
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
        public string dmDeviceName;
        public short dmSpecVersion;
        public short dmDriverVersion;
        public short dmSize;
        public short dmDriverExtra;
        public int dmFields;
        public short dmOrientation;
        public short dmPaperSize;
        public short dmPaperLength;
        public short dmPaperWidth;
        public short dmScale;
        public short dmCopies;
        public short dmDefaultSource;
        public short dmPrintQuality;
        public short dmColor;
        public short dmDuplex;
        public short dmYResolution;
        public short dmTTOption;
        public short dmCollate;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
        public string dmFormName;
        public short dmLogPixels;
        public short dmBitsPerPel;
        public int dmPelsWidth;
        public int dmPelsHeight;
        public int dmDisplayFlags;
        public int dmDisplayFrequency;
        public int dmICMMethod;
        public int dmICMIntent;
        public int dmMediaType;
        public int dmDitherType;
        public int dmReserved1;
        public int dmReserved2;
        public int dmPanningWidth;
        public int dmPanningHeight;
    };

    class User_32
    {
        [DllImport("user32.dll")]
        public static extern int EnumDisplaySettings(string deviceName, int modeNum, ref DEVMODE1 devMode);
    }
    
    public class Displays
    {
		
	    public static string GetCurrentResolution(string deviceName)
        {
            string returnValue = null;
            
            DEVMODE1 dm = new DEVMODE1();
            dm.dmDeviceName = new String(new char[32]);
            dm.dmFormName = new String(new char[32]);
            dm.dmSize = (short)Marshal.SizeOf(dm);
            
            if (0 != User_32.EnumDisplaySettings(deviceName, -1, ref dm))
            {
                returnValue = "[2]:resolution_wh_os: " + dm.dmPelsWidth + " " + dm.dmPelsHeight;
            }
            return returnValue;
        }
    }
}
"@
Add-Type $PICode

$nscreens = 0;
$primaryscreen = 0;
Add-Type -AssemblyName System.Windows.Forms
[System.Windows.Forms.Screen]::AllScreens |
ForEach-Object {
     $nscreens = $nscreens + 1
     echo ("")
     echo ("---- start screen number " + $nscreens + " ----")
     echo ("[0]:device_name: " + $_.DeviceName)
     echo ("[4]:bounds_ltrb_sc: " + $_.Bounds.Left + " " + $_.Bounds.Top + " " + $_.Bounds.Right + " " + $_.Bounds.Bottom)
     echo ("[4]:workingarea_ltrb_sc: " + $_.WorkingArea.Left + " " + $_.WorkingArea.Top + " " + $_.WorkingArea.Right + " " + $_.WorkingArea.Bottom)
     echo ("[1]:isprimaryscreen: " + $_.Primary)
     [Resolution.Displays]::GetCurrentResolution($_.DeviceName)
     echo ("---- end screen number " + $nscreens + " ----")
     echo ("")

     if ($_.Primary)
     {
         $primaryscreen = $nscreens
     }

     # DETAILED OUTPUT IF ACTIVATED
     # echo $_.BitsPerPixel
     # echo $_Bounds
     # echo $_DeviceName
     # echo $_Primary
     # echo $_WorkingArea

}  # End For Each Object

echo ("---- start general ----")

Add-Type -AssemblyName System.Windows.Forms;
echo("[1]:numberofscreens: " + [System.Windows.Forms.SystemInformation]::MonitorCount)

# echo("[1]:primaryscreen: " + $primaryscreen)

$VirtualScreen = [System.Windows.Forms.SystemInformation]::VirtualScreen
echo("[4]:virtualscreen_ltrb_sc: " + $VirtualScreen.Left + " " + $VirtualScreen.Top + " " + $VirtualScreen.Right + " " + $VirtualScreen.Bottom)

#$WorkingArea = [System.Windows.Forms.SystemInformation]::WorkingArea
#echo("[4]:virtualworkingarea_ltrb_sc: " + $WorkingArea.Left + " " + $WorkingArea.Top + " " + $WorkingArea.Right + " " + $WorkingArea.Bottom)

$PrimaryMonitorMaximizedWindowSize = [System.Windows.Forms.SystemInformation]::PrimaryMonitorMaximizedWindowSize
echo("[2]:primaryscreenmaximizedwindowsize_wh_sc: " + $PrimaryMonitorMaximizedWindowSize.Width + " " + $PrimaryMonitorMaximizedWindowSize.Height)

$MinimumWindowSize = [System.Windows.Forms.SystemInformation]::MinimumWindowSize
echo("[2]:minimumwindowsize_wh_sc: " + $MinimumWindowSize.Width + " " + $MinimumWindowSize.Height)

$BorderSize = [System.Windows.Forms.SystemInformation]::BorderSize;
echo("[2]:bordersize_wh_sc: " + $BorderSize.Width + " " + $BorderSize.Height)

$FrameBorderSize = [System.Windows.Forms.SystemInformation]::FrameBorderSize;
echo("[2]:framebordersize_wh_sc: " + $FrameBorderSize.Width + " " + $FrameBorderSize.Height)

$FixedFrameBorderSize = [System.Windows.Forms.SystemInformation]::FixedFrameBorderSize;
echo ("[2]:fixedframebordersize_wh_sc: " + $FixedFrameBorderSize.Width + " " + $FixedFrameBorderSize.Height)

echo("[1]:captionheight_sc: " + [System.Windows.Forms.SystemInformation]::CaptionHeight)
echo("[1]:menuheight_sc: " + [System.Windows.Forms.SystemInformation]::MenuHeight)

$MenuFont = [System.Windows.Forms.SystemInformation]::MenuFont
echo("[0]:systemfont: " + $MenuFont.Name)
echo("[1]:systemfontsize_pi: " + $MenuFont.Size)
echo("[1]:systemfontsize_po: " + $MenuFont.SizeInPoints)
echo("[1]:systemfontlogicalheight: " + $MenuFont.Height)

echo("[1]:horizontalscrollbararrowwidth: " + [System.Windows.Forms.SystemInformation]::HorizontalScrollBarArrowWidth)
echo("[0]:computername: " + [System.Windows.Forms.SystemInformation]::ComputerName)
echo("[0]:username: " + [System.Windows.Forms.SystemInformation]::UserName)
echo("[0]:userdomainname: " + [System.Windows.Forms.SystemInformation]::UserDomainName)

echo ("---- end general ----")
echo (" ")
echo ("---- start fonts ----")

Add-Type -AssemblyName PresentationCore
[Windows.Media.Fonts]::SystemFontFamilies | Select-Object -Property Source

echo ("---- end fonts ----")