BrightnessTray.NativeMethods.EnumButtonWindow C# (CSharp) Метод

EnumButtonWindow() публичный статический Метод

Enumerates windows with the class name 'Button' and a blank window name.
public static EnumButtonWindow ( IntPtr handle, IntPtr pointer ) : bool
handle System.IntPtr A handle to a top-level window.
pointer System.IntPtr The application-defined value given in EnumWindows or EnumDesktopWindows.
Результат bool
        public static bool EnumButtonWindow(IntPtr handle, IntPtr pointer)
        {
            GCHandle gch = GCHandle.FromIntPtr(pointer);

            List<IntPtr> list = gch.Target as List<IntPtr>;

            if (list == null)
                throw new InvalidCastException("GCHandle Target could not be cast as List<IntPtr>");

            StringBuilder classname = new StringBuilder(128);

            GetClassName(handle, classname, classname.Capacity);

            if (classname.ToString() == "Button" && GetWindowTextLength(handle) == 0)
                list.Add(handle);

            return true;
        }