At DevConnections this week, I wanted to demonstrate how easy it can be to write preview handlers for Windows Vista.  Using the framework I created for my article in the January 2007 issue of MSDN Magazine, I whipped up this little guy:

    [PreviewHandler("MSDN Magazine DLL Preview Handler", ".dll", "{1A565B60-5BEA-463d-9413-9F201320A2BB}")]
    [ProgId("MsdnMag.DllPreviewHandler")]
    [Guid("42382862-EFA1-43dc-885A-D02D9B93B320")]
    [ClassInterface(ClassInterfaceType.None)]
    [ComVisible(true)]
    public sealed class DllPreviewHandler : FileBasedPreviewHandler
    {
        protected override PreviewHandlerControl CreatePreviewHandlerControl()
        {
            return new DllPreviewHandlerControl();
        }

        private sealed class DllPreviewHandlerControl : FileBasedPreviewHandlerControl
        {
            public override void Load(FileInfo file)
            {
                TextBox text = new TextBox();
                text.ReadOnly = true;
                text.BackColor = SystemColors.Window;
                text.ScrollBars = ScrollBars.Vertical;
                text.Multiline = true;
                text.Dock = DockStyle.Fill;

                ProcessStartInfo psi = new ProcessStartInfo(
                    @"C:\program files\Microsoft SDKs\Windows\v6.0\VC\Bin\dumpbin.exe",
                    "/summary /exports \"" + file.FullName + "\"");
                psi.UseShellExecute = false;
                psi.RedirectStandardOutput = true;
                psi.CreateNoWindow = true;

                using (Process p = Process.Start(psi))
                {
                    text.Text = p.StandardOutput.ReadToEnd();
                }

                Controls.Add(text);
            }
        }
    }

The preview handler displays the results of running dumpbin.exe on the selected DLL, showing all of the exports from the DLL.  If you do a lot of P/Invoke work, something like this can come in very handy when browsing a directory of DLLs.  To accomplish this, it simply creates a TextBox, spawns a process to run dumpbin, and stuffs the output from dumpbin into the TextBox.

Note that for this to compile and work, you'll need to reference the DLL provided along with the magazine article.  Once you install it, you'll get nice views like this:

On your system, you may need to change the path to dumpbin.exe, which I've hardcoded here for simplicity of example. YMMV.