Updated 09-February-2009: Compiled specifically targeting x86, so that you can shim this on x64 builds of Windows. 

Updated 18-April-2008: I did a clean build of this on Visual Studio 2008 before posting, and I forgot about the built-in automatic manifests. These manifests disable some of the shims, and also turn off the installer detection. Updating the attachment to remove these manifests. 

The Stock Viewer Shim Demo Application is an application I have been using to demonstrate Mitigating Windows Vista Application Compatibility Issues Using Shims at various conferences and with various customers. By popular demand, I am posting the sample application.

The primary user interface is lifted directly from windowsclient.net - the good code is theirs, the (intentionally) bad code is mine.

Please note that the application was developed purely to support my scripted demos and labs - I can make no promises about how it behaves when you are not following the script.

I have packaged the demo as an MSI because I need to flip some registry bits to set up the control panel applet. Feel free to explore the MSI prior to installation to review the registry settings that I use. The installer drops all of the sample applications, registers the control panel applet, drops the demo guide as an XPS file, and sets up start menu shortcuts.

For those of you who speak WIX, here is the entire installer:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">

  <Product Id="{0AF2176E-E9E4-4f9e-A573-905466C09047}" Name="Stock Viewer Shim Demo Application" Language="1033" Version="1.0.0.0" Manufacturer="Microsoft Corporation" UpgradeCode="98382F9A-CE19-4026-8457-4FD433A61889">
    <Package Description="Stock Viewer Shim Demo Application" Manufacturer="Microsoft Corportion" Comments="This is a Stock Viewer application with intentional errors, used to demonstrate using shims to resolve these issues." InstallerVersion="200" Compressed="yes" />

    <WixVariable Id="WixUILicenseRtf" Value=".\license.rtf" />
    <UIRef Id="WixUI_Minimal" />

    <Media Id='1' Cabinet='stockvwr.cab' EmbedCab='yes' VolumeLabel='StockVwr'>
    </Media>
    <Condition Message='This sample only runs on Windows Vista and above.'>VersionNT &gt;= 600</Condition>

    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="ProgramFilesFolder">
        <Directory Id="INSTALLLOCATION" Name="StockViewer" >

          <Component Id="StockViewer" Guid="{0C384418-76B8-43de-95C5-796D7636A525}">
            <File Id="DWM_CRD" Assembly="no" Name="DWM Compositing Rendering Demo.exe" Source="..\StockViewer\bin\Release\DWM Compositing Rendering Demo.exe" DiskId="1" />
            <File Id="OLAF" Assembly="no" Name="OLAF.exe" Source="..\StockViewer\bin\Release\OLAF.exe" DiskId="1" />
            <File Id="StockVwr" Assembly="no" Name="StockViewer.exe" Source="..\StockViewer\bin\Release\StockViewer.exe" DiskId="1" >
              <Shortcut Id="startMenuStockViewer" Directory="ProgramMenuDir" Name="Stock Viewer" WorkingDirectory="INSTALLLOCATION" />
            </File>
            <File Id="StkVwrCP" Assembly="no" Name="StockViewerControlPanel.exe" Source="..\StockViewer\bin\Release\StockViewerControlPanel.exe" DiskId="1" />
            <File Id="StkVwrUO" Assembly="no" Name="StockViewerUpdateOrders.exe" Source="..\StockViewer\bin\Release\StockViewerUpdateOrders.exe" DiskId="1" />
            <File Id="StkVwrUp" Assembly="no" Name="StockViewerUpdater.exe" Source="..\StockViewer\bin\Release\StockViewerUpdater.exe" DiskId="1" />
            <File Id="StockIco" Assembly="no" Name="Stocks.ico" Source="..\StockViewer\bin\Release\Stocks.ico" DiskId="1" />
            <File Id="LabGuide" Assembly="no" Name="Mitigating Application Issues Using Shims - Lab Guide.xps" Source="..\Mitigating Application Issues Using Shims - Lab Guide.xps" DiskId="1">
              <Shortcut Id="startMenuLabGuide" Directory="ProgramMenuDir" Name="Lab Guide" WorkingDirectory="INSTALLLOCATION" />
            </File>
            <RegistryKey Id="CplNamespaceKey" Root="HKLM" Key="Software\Microsoft\Windows\CurrentVersion\Explorer\ControlPanel\Namespace\{DF5BF128-5283-4d39-8BC0-EC09F526E673}" Action="createAndRemoveOnUninstall" >
              <RegistryValue Id="CplNamespaceValue" Value="StockViewerApplet" Type="string" Action="write" />
            </RegistryKey>
            <RegistryKey Id="CplClassIdKey" Root="HKCR" Key="CLSID\{DF5BF128-5283-4d39-8BC0-EC09F526E673}" Action="createAndRemoveOnUninstall" >
              <RegistryValue Id="CplClassIdValue" Value="StockViewerApplet" Action="write" Type="string" />
              <RegistryValue Id="CplAppNameValue" Name="System.ApplicationName" Value="Microsoft.Demos.StockViewerApplet" Action="write" Type="string" />
              <RegistryValue Id="CplAppCategoryValue" Name="System.ControlPanel.Category" Value="1,8" Type="string" Action="write" />
              <RegistryValue Id="CplLocalizedStringValue" Name="LocalizedString" Value="Stock Viewer Settings" Type="expandable" Action="write" />
              <RegistryValue Id="CplInfoTipValue" Name="InfoTip" Value="Sets Stock Viewer Settings" Type="expandable" Action="write" />
              <RegistryKey Id="CplDefaultIconKey" Key="DefaultIcon" Action="createAndRemoveOnUninstall" >
                <RegistryValue Id="CplDefaultIconValue" Value="%ProgramFiles%\StockViewer\Stocks.ico" Type="expandable" Action="write" />
              </RegistryKey>
              <RegistryKey Id="CplShellKey" Key="Shell\Open\Command" Action="createAndRemoveOnUninstall" >
                <RegistryValue Id="CplShellValue" Value="%ProgramFiles%\StockViewer\StockViewerControlPanel.exe" Type="expandable" Action="write" />
              </RegistryKey>
            </RegistryKey>
          </Component>
          <Directory Id="Data" Name="Data">
            <Component Id="StockViewerData" Guid="{3517F0AE-CDC6-48b7-83F9-BC53F32E5CBB}">
              <File Id="SPY" Assembly="no" Name="spy.xml" Source="..\StockViewer\bin\Release\Data\spy.xml" DiskId="1" />
            </Component>
          </Directory>
        </Directory>
      </Directory>
      <Directory Id="ProgramMenuFolder" Name="Programs" >
        <Directory Id="ProgramMenuDir" Name="Stock Viewer" />
      </Directory>
    </Directory>

    <Feature Id="StockViewerAll" Title="All Stock Viewer Files" Level="1">
      <ComponentRef Id="StockViewer" />
      <ComponentRef Id="StockViewerData"/>
    </Feature>

  </Product>
</Wix>