Create multiple file extensions with the ClickOnce Installer

  • Thread starter Thread starter Allen Johnson III
  • Start date Start date
A

Allen Johnson III

Guest
We are finally getting around to using W10 OS on our machines.

In the past, I used the HEKY.ClassesRoot to set the paths. But under W10 on the new machines (even if the user is set as an Administrator), Windows won't let me set keys in that section. I found something online that says the associations are also stored per user under the HKEY_CURRENT_USER\Software\Classes tree.

So I used the File Associations in the Publish Options button in the properties screen to set the extensions. But if I have multiple file extensions, when I click on them, the application doesn't start. I checked the HKEY_CURRENT_USER\Software\Classes tree and do not see the shell\open\command key that starts the program, i.e., "C:\Program Files (x86)\DWA\Seismic Design Criteria - ASCE7-05 .exe" "%1"

The code below is what I use to create the file associations in the program before in W7 machines.

Any idea how to fix it to use the CurrentUser key instead, or to get the File Associations tab in the properties to set the right startup command?

Thanks.


Public Sub CreateFileAssociation(AppName As String, AppDesc As String, ExtnName As String)

With My.Computer.Registry.ClassesRoot

'Create the extension key linked to the AppName key
.CreateSubKey(ExtnName).SetValue("", AppName, Microsoft.Win32.RegistryValueKind.String)

'Create the file description that is displayed in Windows Explorer under the AppName key's default value
.CreateSubKey(AppName).SetValue("", AppDesc, Microsoft.Win32.RegistryValueKind.String)

'Create the default icon key under the AppName key
.CreateSubKey(AppName & "\DefaultIcon").SetValue _
("", Application.ExecutablePath & ",0", Microsoft.Win32.RegistryValueKind.String)

'Create the link to run the program under the AppName key
.CreateSubKey(AppName & "\shell\open\command").SetValue _
("", Application.ExecutablePath & " ""%1"" ", Microsoft.Win32.RegistryValueKind.String)
End With

End Sub

Continue reading...
 
Back
Top