public static string[] GetDesktops() { IntPtr processWindowStation = SEBDesktopController.GetProcessWindowStation(); if (processWindowStation == IntPtr.Zero) { return(new string[0]); } string[] strArray; lock (SEBDesktopController.m_sc = new StringCollection()) { if (!SEBDesktopController.EnumDesktops(processWindowStation, new SEBDesktopController.EnumDesktopProc(SEBDesktopController.DesktopProc), IntPtr.Zero)) { return(new string[0]); } strArray = new string[SEBDesktopController.m_sc.Count]; for (int index = 0; index < strArray.Length; ++index) { strArray[index] = SEBDesktopController.m_sc[index]; } } return(strArray); }