Exemple #1
0
        public void enumwinstation()
        {
            IList <string>             list      = new List <string>();
            GCHandle                   gch       = GCHandle.Alloc(list);
            EnumWindowStationsDelegate childProc = new EnumWindowStationsDelegate(EnumWindowStationsCallback);

            EnumWindowStations(childProc, GCHandle.ToIntPtr(gch));

            foreach (string ws in list)
            {
                List <string> desktops = WindowStation.EnumerateDesktops(ws);

                foreach (string desktop in desktops)
                {
                    try
                    {
                        AddToList2(ws, desktop);
                    }
                    catch (Exception)
                    {
                        AddToList2("-", "-");
                    }
                }
            }
        }
        public static string[] GetWindowStationNames()
        {
            IList <string>             list     = new List <string>();
            EnumWindowStationsDelegate callback = new EnumWindowStationsDelegate((string windowStation, IntPtr lParam) => {
                list.Add(windowStation);
                return(true);
            });

            if (!EnumWindowStations(callback, IntPtr.Zero))
            {
                throw new Win32ErrorCodeException("EnumWindowStations");
            }


            return(list.ToArray());
        }
 public static extern bool EnumWindowStations(EnumWindowStationsDelegate lpEnumFunc,
                                              IntPtr lParam);
Exemple #4
0
 public static extern bool EnumWindowStations(EnumWindowStationsDelegate lpEnumFunc, IntPtr lParam);