How do I put an icon in the splash screen and about box?

I've seen several questions about changes in the VS2005 splash screen and about box. Here are the changes in a nutshell:

  • Visual Studio uses the same icon for both splash screen and about box. Supply a 16×16 image for the splash screen and a 32×32 image for the about box.
  • IdBmpSplash is no longer called. Instead, IdIcoLogoForAboutbox is called for both splash screen and about box.
  • High-color icons are supported; you don't have to use "transparent background color" tricks any more.
  • The splash screen uses the name of the registry key for your product under HKLM\SOFTWARE\Microsoft\VisualStudio\8.0\InstalledProducts as your product's display name.

I wrote the following how-to and walkthrough to detail the changes. Please let me know if you have any questions, comments, or gripes!

How to

VSPackages can display icons and textual information about products (together called logos) in the Visual Studio splash screen and about box. For every product you add as a VSPackage, you can add one logo. The splash screen and about box contain logos for the Visual Studio core products and any other installed products.  The following guidelines apply to all logos. 

  • The same icon resource is used for the splash screen and the about box. Your VSPackage's icon resource should include a 16 × 16 image for the splash screen and a 32 × 32 image for the about box. If you provide only one image size, it will be resized as needed, but the visual results will be suboptimal.

  • Your VSPackage installer must run devenv.exe /setup to make its logo appear.

To show product information in the splash screen or about box, your VSPackage must list itself in the InstalledProducts registry key and either:

  • Implement Microsoft.VisualStudio.Shell.Interop.IVsInstalledProduct.

-or-

  • For just the about box, provide detailed product information under the InstalledProducts registry key.

Implementing Microsoft.VisualStudio.Shell.Interop.IVsInstalledProduct is the most powerful approach. It provides all the functionality of the registry entries and lets you provide a logo for the splash screen. If you want your product information only in the about box, providing detailed product information under the InstalledProducts registry key is sufficient. If you do both, the implementation of Microsoft.VisualStudio.Shell.Interop.IVsInstalledProduct takes precedence.

To register your VSPackage as an installed product for both splash screen and about box

· Add the information in the table below to the registry under the following key:

 HKLM\Software\Microsoft\VisualStudio\versionNumber\InstalledProducts\yourProductName

Where versionNumber is the version of Visual Studio into which your VSPackage is integrating (7.0, 7.1, or 8.0) and yourProductName is the string displayed next to your product icon in the splash screen.

For example, the Figures sample writes the following registry information, supplying most product information in its implementation of Microsoft.VisualStudio.Shell.Interop.IVsInstalledProduct:

 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\InstalledProducts\FiguresProductSample]
"Package"="{ACEF4EB2-57CF-11D2-96F4-000000000000}"
"UseInterface"=dword:00000001

Name

Type

Range

Description

Package

REG_SZ

GUID

Your VSPackage GUID, which is required for both splash screen and about box.

UseInterface

REG_DWORD

0 or 1

A value of 1 indicates that Visual Studio should get product information by calling your VSPackage's implementation of Microsoft.VisualStudio.Shell.Interop.IVsInstalledProduct instead of relying on other entries under this registry key.

 

To implement IVsInstalledProduct for both splash screen and about box

1.      Implement the Microsoft.VisualStudio.Shell.Interop.IVsInstalledProduct interface on the same class that implements Microsoft.VisualStudio.Shell.Interop.IVsPackage.

Both the splash screen and about box will call your Microsoft.VisualStudio.Shell.Interop.IVsInstalledProduct implementation to get the required information.

2.      As part of your deployment (for example, in your VSPackage's installer), execute a command line of devenv /setup to register your package and its product information. If you fail to do this step, your VSPackage will be called to provide information for the about box, but not for the splash screen. If you are using the experimental environment, use devenv /rootsuffix Exp /setup.

3.      To test your VSPackage's splash screen support, use DevEnv's /splash switch. For example, to see the splash screen registration for the experimental environment, use devenv /rootsuffix Exp /splash.

 

To provided detailed product information in the registry for just the about box

· In addition to the Package and UseInterface entries, add the information in the table below to the registry under HKLM\Software\Microsoft\VisualStudio\VSVersion\InstalledProducts\yourProductName

Note   This information is ignored if UseInterface is 1.

Name

Type

Range

Description

(default value)

REG_SZ

String or resource ID preceded by #

Product name to be displayed to the user in the about box, as a string or as the ID of a string resource in your satellite DLL. As the splash screen uses the yourProductName registry key name as the product name to be displayed, it and this registry value should be consistent.

DefaultProductAttribute

REG_SZ

String

For partners integrating into the Premier Partner Edition of Visual Studio, this registry entry specifies the environment's default Product attribute for use in the Dynamic Help window.

This registry entry has no effect in any other edition of Visual Studio.

ProductDetails

REG_SZ

String or resource ID preceded by #

Product details to be displayed to the user, as a string or as a resource ID in your satellite DLL.

LogoID

REG_SZ

Resource ID preceded by #

Resource ID in your satellite DLL of the product icon you want to appear in the about box.

PID   

REG_SZ

String or resource ID preceded by #

Product identifier — usually the version of your product as a string.

If you are developing a managed VSPackage, you can apply Microsoft.VisualStudio.Shell.InstalledProductRegistrationAttribute to your Microsoft.VisualStudio.Shell.Package subclass. For example:

 using MSVSIP = Microsoft.VisualStudio.Shell;
...
[MSVSIP.InstalledProductRegistration(
    ProductNameResId = 100, 
    ProductDetailsResId = 102, 
    IconResId = 400, 
    ProductId = "1.0")]
...
public class SampleDocViewEditor : MSVSIP.Package
...

The RegPkg utility reads the Microsoft.VisualStudio.Shell.InstalledProductRegistrationAttribute attribute and makes the appropriate registry entries based on the arguments you specify. For more information, see How to: Register Managed VSPackages.

 

Walkthrough

This walkthrough demonstrates the process of adding support for the Visual Studio splash screen and About box to a VSPackage. For more information, see How to: Show Product Information in the Splash Screen and About Box.

This walkthrough builds on a new VSPackage created by the Visual Studio Integration Package Wizard.

To create the sample VSPackage

1.      On the File menu, point to New, and then click Project.
2.      Expand Other Project Types, and click Extensibility.
3.      In the Templates pane, click Visual Studio Integration Package, type a name in the Name box, and click OK.
The wizard starts.
4.      In the Select a Programming Language page, select Visual C# .
5.      Accept default choices on remaining pages and click Finish on the last page.

Creating a VSPackage that Shows an Icon on the Splash Screen and About Box

If you build and debug the VSPackage as created by the wizard, you can see that there is no splash screen icon for the VSPackage. However, there is an icon and descriptive text in the About box. In this procedure, you implement the Microsoft.VisualStudio.Shell.Interop.IVsInstalledProduct interface so an icon appears on the splash screen as well.

To implement the IVsInstalledProduct interface

1.      In VsPkg.cs, add the following using directive:

 using Microsoft.VisualStudio;

2.      Change the first argument of the package class's Microsoft.VisualStudio.Shell.InstalledProductRegistrationAttribute attribute from false to true. Doing so sets the UseInterface registry value to 1, as Visual Studio requires.

 [MSVSIP.DefaultRegistryRoot("Software\\Microsoft\\VisualStudio\\8.0")]
 [MSVSIP.InstalledProductRegistration(true, "#100", "#102", "1.0", IconResourceID = 400)] 
[MSVSIP.ProvideLoadKey("Standard", "1.0", "Package Name", "Company", 1)]
[Guid("3bd4a10b-a473-4620-af99-61284b8ce044")]
public sealed class SplashPkg : MSVSIP.Package
...

3.      Add Microsoft.VisualStudio.Shell.Interop.IVsInstalledProduct to the base list of the package class, to indicate the class implements that interface.

 public sealed class SplashPkg : MSVSIP.Package, IVsInstalledProduct
...

4.      Right-click IVsInstalledProduct, point to Implement Interface, and click Implement Interface.

5.  At the bottom of the package class, find the region titled IVsInstalledProduct Members. Replace the methods as follows:

 #region IVsInstalledProduct Members
 public int IdBmpSplash(out uint pIdBmp)
{
   pIdBmp = 0;
   return VSConstants.S_OK;
}
 public int IdIcoLogoForAboutbox(out uint pIdIco)
{
   pIdIco = 400;
   return VSConstants.S_OK;
}
 public int OfficialName(out string pbstrName)
{
   pbstrName = "VSIP SplashAbout Package";
   return VSConstants.S_OK;
}
 public int ProductDetails(out string pbstrProductDetails)
{
   pbstrProductDetails =
         "Thank you for using SplashAbout for all " +
         "your splash screen and about box needs. " +
         "Be sure to check out SplashAbout Enterprise Edition! " +
         "You can return a fairly long string in ProductDetails.";
    return VSConstants.S_OK;
}
 public int ProductID(out string pbstrPID)
{
   pbstrPID = "Version 1.0.40823 / Serial #00101010";
   return VSConstants.S_OK;
}
 #endregion

6.  Build the solution, then open a Visual Studio Command Prompt, and execute the following commands to register your VSPackage.

 devenv /rootsuffix Exp /setup

7.  Execute the following command to show the splash screen and pause, so you can see it:

 devenv /rootsuffix Exp /splash

8.  Choose About Microsoft Visual Studio from the Help menu to see the product details for your VSPackage.

Bob Arnson
Programming Writer
Visual Studio SDK