Example #1
0
        public static bool TryGetCurrentThemeName(out string themeName, out string color, out string size)
        {
            StringBuilder nameBuilder  = new StringBuilder(512);
            StringBuilder colorBuilder = new StringBuilder(512);
            StringBuilder sizeBuilder  = new StringBuilder(512);
            int           hr           = GetCurrentThemeName(nameBuilder, nameBuilder.Capacity, colorBuilder, colorBuilder.Capacity, sizeBuilder, sizeBuilder.Capacity);

            if (hr == 0)
            {
                themeName = nameBuilder.ToString();
                color     = colorBuilder.ToString();
                size      = sizeBuilder.ToString();
                return(true);
            }
            else
            {
                themeName = null;
                color     = null;
                size      = null;
                if (hr != Extension.AsHRESULT(Win32ErrorCode.ELEMENT_NOT_FOUND))
                {
                    Debug.Fail("GetCurrentThemeName returned: " + hr.ToString());
                }

                return(false);
            }
        }