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