Feedback

Öffnet den Windows Info Dialog.

Sprache: C#

Mit dieser Funktion kann der Windows Info Dialog als Info Dialog für eigene Anwendungen verwendet werden. Es kann ein Icon, ein Beschreibungstext und eine Dialog Caption angegeben werden.
namespace Microsoft.Win32.Shell32
{
    using System;
    using System.Text;
    using System.Collections.Generic;
    using System.Runtime.InteropServices;

    public class ShellAboutDialog
    {
        [DllImport("Shell32.dll", CharSet = CharSet.Auto)]
        public static extern int ShellAbout(
            IntPtr hWnd,
            [MarshalAs(UnmanagedType.LPTStr)] string szApp,
            [MarshalAs(UnmanagedType.LPTStr)] string szOtherStuff,
            IntPtr hIcon);
    }
}

/// Beispiel: Bitte eine neue Konsolenanwendung erstellen!
namespace TestShellAbout
{
    using System;
    using System.Text;
    using System.Drawing;
    using Microsoft.Win32.Shell32;

    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                Console.WriteLine("Microsoft Windows Shell - Test Utility v1.0");
                Console.WriteLine("");

                // TODO: Change the path to a valid ico file
                Icon icon = Icon.ExtractAssociatedIcon(@"D:Visual Studio 2005ResourcesApp.ico");

                ShellAboutDialog.ShellAbout(IntPtr.Zero, "Microsoft Windows Shell - Test Utility v1.0", Environment.NewLine + "Specialwork Software", icon.Handle);
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception.Message);
            }
            finally
            {
                Console.WriteLine("Press a key to exit");
                Console.WriteLine("");
            }
        }
    }
}
namespace Microsoft.Win32.Shell32
{
    using System;
    using System.Text;
    using System.Collections.Generic;
    using System.Runtime.InteropServices;

    public class ShellAboutDialog
    {
        [DllImport("Shell32.dll", CharSet = CharSet.Auto)]
        public static extern int ShellAbout(
            IntPtr hWnd,
            [MarshalAs(UnmanagedType.LPTStr)] string szApp,
            [MarshalAs(UnmanagedType.LPTStr)] string szOtherStuff,
            IntPtr hIcon);
    }
}

/// Beispiel: Bitte eine neue Konsolenanwendung erstellen!
namespace TestShellAbout
{
    using System;
    using System.Text;
    using System.Drawing;
    using Microsoft.Win32.Shell32;

    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                Console.WriteLine("Microsoft Windows Shell - Test Utility v1.0");
                Console.WriteLine("");

                // TODO: Change the path to a valid ico file
                Icon icon = Icon.ExtractAssociatedIcon(@"D:Visual Studio 2005ResourcesApp.ico");

                ShellAboutDialog.ShellAbout(IntPtr.Zero, "Microsoft Windows Shell - Test Utility v1.0", Environment.NewLine + "Specialwork Software", icon.Handle);
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception.Message);
            }
            finally
            {
                Console.WriteLine("Press a key to exit");
                Console.WriteLine("");
            }
        }
    }
}

1 Kommentar