Translate this site using Windows Live Translator:
How do I put an icon in the splash screen and about box? - A CRM Riff - Site Home - MSDN Blogs
A CRM Riff
It takes people to make the music of life

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

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

  • Comments 5

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

  • Good stuff!

    Are icon files with two 16x16 and 32x32 images (both 16 colors) in one file supported?

    What's odd though is that VS seems to pickup correct 16x16 for the splash screen regardless of what I set pIdBmp to 0 in IdBmpSplash(). The only issue I have is that the splash icon has some garbage where transparent area is.

    Let me know if it's better to take this to support forums.
  • Sergey--

    Yep -- the idea now is to use a single icon for both, with multiple images. I believe any color depth is supported, though high-color mode is preferred because you have transparency control without resorting to the "magenta == transparent" trick. In fact, that's no longer supported; the IDE no longer treats magenta pixels as transparent, so you'll want a new icon anyway.

    As I recall from beta 2, IdBmpSplash isn't even called any more. IdIcoLogoForAboutbox is called for both. The IDE will let Windows resize your 32x32 icon if you don't supply a 16x16 image, but it's almost always going to look a lot worse than an artistic type could provide. 8)

    --boB
  • Bob, Jim,

    It appears that at least for Beta 2, 32bit 16x16 icon is required for the IDE to show it correctly on the splash screen.

    My package, converted from VS'03, already has an icon file with 16x16 and 32x32 icon, both 4bit. Whidbey Beta 2 displayed my 4bit icon with a black color in place of transparent area. Adding a 32bit icon fixed the problem.

    Thought I'd share this with you.
  • Thanks for the article, it clearifies most of my questions. The only problem I still have is the fact that InstalledProductRegistrationAttribute allways uses the class name for the key name in "...\InstalledProducts". As this is the string to be shown in the Splash screen, it would be much better if the ProductName property would be used as key.
  • PingBack from http://thebasketballhoop.info/story.php?id=76

Page 1 of 1 (5 items)
Leave a Comment
  • Please add 7 and 6 and type the answer here:
  • Post