コード例 #1
0
        private string GetCaption(uint id)
        {
#pragma warning disable 618
            if (this.user32 == null)
            {
                this.user32 = UnsafeNativeMethods.LoadLibrary(Path.Combine(Environment.SystemDirectory, "User32.dll"));
            }

            var sb = new StringBuilder(256);
            if (UnsafeNativeMethods.LoadString(this.user32, id, sb, sb.Capacity) == 0)
            {
                sb.Clear();
                sb.AppendFormat("String with id '{0}' could not be found.", id);
            }
#pragma warning restore 618
            return(sb.ToString().Replace("&", string.Empty));
        }