How add value on hkey_classes_root key where the application installed
Asked Answered
C

1

7

Solved!!

I am trying to create a Custom URL Protocol of my application that will launch my application when they visit or clicked link to myapp:start

My problem is how to know where the user installed my application. Can the msi installer put the location when registering HKEY_CLASSES_ROOT to registry?

HKEY_CLASSES_ROOT
   myapp
      (Default) = "URL:myapp Protocol"
      URL Protocol = ""
      DefaultIcon
           (Default) = "myapp.exe,1"
      shell
           open
               command
                   (Default) = "C:\Program Files\MyAppFolder\MyApp.exe" "%1"

I wanted to change the path "C:\Program Files\MyAppFolder\MyApp.exe" to where the user installed my app during installation process.

Solution

HKEY_CLASSES_ROOT
   myapp
      (Default) = "URL:myapp Protocol"
      URL Protocol = ""
      DefaultIcon
           (Default) = "myapp.exe,1"
      shell
           open
               command
                   (Default) = "[TARGETDIR]MyApp.exe "%1""

[TARGETDIR] will automatically change to where the user installed the file e.g. "C:\Program Files\MyAppFolder\"

For more information click this link -> Registering an Application to a URI Scheme

Canossa answered 11/3, 2013 at 10:51 Comment(3)
What are you using to create your MSI?Bibliopole
the normal setup project for visual studio 2010Canossa
Probably - but we'd need to know which specific technology you're using to author your installation package.Goldston
B
4

With the Visual Studio Setup Project, you can use the [TARGETDIR] variable when creating your registry key.

This variable is automatically set to the target directory that your application is being installed into, simply append your .exe file to the end.

Bibliopole answered 11/3, 2013 at 10:55 Comment(3)
is it like this? (Default) = "[TARGETDIR]\MyApp.exe" "%1"Canossa
I don't have VS2010 around, but you can refer to this question which is doing the same thing. By the looks of things, you have a .reg file? It won't work from this.Bibliopole
Wait, this site is probably better.Bibliopole

© 2022 - 2024 — McMap. All rights reserved.