Desktop information can be very important when putting your code on another computer. Using the WMI Win32_Desktop class, we can retrieve important information about a local computer's desktop.
From MSDN:
The Win32_Desktop WMI class represents the common characteristics of a user's desktop. The properties of this class can be modified by the user to customize the desktop.
Sample usage
Function GetDesktopInfo()
Dim objWMI As Object
Dim desktops As Object
Dim desktop As Object
Set objWMI = GetWMIService
Set desktops = objWMI.ExecQuery("Select * from Win32_Desktop")
For Each desktop In desktops
Debug.Print desktop.BorderWidth
Debug.Print desktop.Caption
Debug.Print desktop.CoolSwitch
Debug.Print desktop.CursorBlinkRate
Debug.Print desktop.Description
Debug.Print desktop.DragFullWindows
Debug.Print desktop.GridGranularity
Debug.Print desktop.IconSpacing
Debug.Print desktop.IconTitleFaceName
Debug.Print desktop.IconTitleSize
Debug.Print desktop.IconTitleWrap
Debug.Print desktop.Name
Debug.Print desktop.Pattern
Debug.Print desktop.ScreenSaverActive
Debug.Print desktop.ScreenSaverExecutable
Debug.Print desktop.ScreenSaverSecure
Debug.Print desktop.ScreenSaverTimeout
Debug.Print desktop.SettingID
Debug.Print desktop.Wallpaper
Debug.Print desktop.WallpaperStretched
Debug.Print desktop.WallpaperTiled
Next desktop
End Function
Function GetWMIService() As Object
' http://msdn.microsoft.com/en-us/library/aa394586(VS.85).aspx
Dim strComputer As String
strComputer = "."
Set GetWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
End Function