2

I want to create an .msi installer that will add a cascading context menu when I right-click my mouse on my desktop. First, I tried doing this using the following script, and this works fine:

[HKEY_CLASSES_ROOT\DesktopBackground\Shell\MyApp]
"MUIVerb"="My Application"
"SubCommands"="app1;app2"
"Position"=-

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\app1]
@="Run App1"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\app1\command]
@="C:\\app1.exe"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\app2]
@="Run App2"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\app2\command]
@="C:\\app2.exe"

However, when I tried doing the same in WiX toolset, this no longer works. I can view "My Application" when I right-click on the desktop, but there are no cascading menus ("Run App1" and "Run App2" are not displayed). Here's my XML code:

<DirectoryRef Id="TARGETDIR">
        <Component Id="RegistryEntries" Guid="ADF145F9-D3C0-4961-A463-812595B9BF60">
            <RegistryKey Root="HKCR"
                Key="DesktopBackground\Shell\MyApp"
                Action="createAndRemoveOnUninstall">
                <RegistryValue Type="string" Name="MUIVerb" Value="My Application" KeyPath="yes"/>
                <RegistryValue Type="string" Name="SubCommands" Value="app1;app2"/>
            </RegistryKey>
            <RegistryKey Root="HKLM"
            Key="SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\app1"
                Action="createAndRemoveOnUninstall">
                <RegistryValue Type="string" Value="Run App1"/>
                <RegistryValue Key="command" Type="string" Value="C:\app1.exe"/>
            </RegistryKey>
            <RegistryKey Root="HKLM"
                Key="SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\app2"
                Action="createAndRemoveOnUninstall">
                <RegistryValue Type="string" Value="Run App2"/>
                <RegistryValue Key="command" Type="string" Value="C:\app2.exe"/>
            </RegistryKey>
        </Component>
    </DirectoryRef>

Please help me solve the problem. Do you have any suggestions? Thank you!

Joan Gan
  • 21
  • 2
  • With your WiX installer, are those keys being created in the registry at all? Can you verify in the second two keys for the HKLM hive that they are being placed properly? – Joe Nov 20 '14 at 19:47
  • Hi Joe, sorry for the late reply. Yes, it is successfully written in the registry. However, no cascading menu appeared when I right-clicked on my Desktop :( I am using a Windows 7 64-bit machine. – Joan Gan Nov 26 '14 at 06:07
  • You specify `Root="HKCR"` for the `DesktopBacgkround\Shell\MyApp` key. You shouldn't write to `HKCR`. This is an amalgamated view of entries contained in both `HKCU` and `HKLM`. Since your other entries are being written to `HKLM`, consider writing that entry there, too. Otherwise, use `HKCU`. Also, you should have one "thing" per `Component`. This will be especially true if you end up writing that key to `HKCU`. – fourpastmidnight Aug 01 '16 at 01:48
  • Hi @Joan-Gan, were you able to solve this? If so, it would be nice to post a answer. Have you tried the sugestons from @fourpastmidnight? – gReX Aug 13 '20 at 09:06

0 Answers0