est ici une façon (en VB). ApplicationTag est un nom court pour le Registre, tel que editor3.1
. Vous pouvez vérifier le registre avec regedit pour voir ce qui se passe, et vous pouvez vouloir faire un point de restauration avant de tester cette partie de votre application.
Imports Microsoft.Win32
...
Registry.SetValue("HKEY_CURRENT_USER\software\classes\" & FileType, "", applicationTag)
q = Registry.CurrentUser.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\" & FileType, True)
If q IsNot Nothing AndAlso q.GetValue("ProgID", "notfound") <> "notfound" Then
q.SetValue("ProgID", appTag) ' for the local user, overrides hkcr
End If
appKey = "HKEY_CURRENT_USER\software\classes\" & applicationTag
Registry.SetValue(appKey, "", "text")
Registry.SetValue(appKey & "\shell", "", "open")
Registry.SetValue(appKey & "\shell\open", "", "")
Registry.SetValue(appKey & "\shell\open\command", "", """" & ApplicationPath & """ ""%1""")
Registry.SetValue(appKey, "", "text")
appKey = "HKEY_CURRENT_USER\software\classes\CLSID\" & ApplicationGuid
Registry.SetValue(appKey, "", applicationTitle)
Registry.SetValue(appKey & "\ProgID", "", applicationTag)