I'm trying to associate file extension to start some type of files with my application. Which registry keys I have to modify to be sure, that when user double click at file it opens with my application.
And how get delete/modify permisions to key "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\<extension>\UserChoice"?
This key created after setting default program by "Open with" dialog.
I've tried:
string ext=".eee";
RegistryKey r = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\FileExts\\"+ext);
RegistryPermission f = new
RegistryPermission(RegistryPermissionAccess.Write, r.Name);
f.Assert();
r.OpenSubKey("UserChoice", true); //at this step "Requested registry access is not allowed." exception occured
And how get delete/modify permisions to key "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\<extension>\UserChoice"?
This key created after setting default program by "Open with" dialog.
I've tried:
string ext=".eee";
RegistryKey r = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\FileExts\\"+ext);
RegistryPermission f = new
RegistryPermission(RegistryPermissionAccess.Write, r.Name);
f.Assert();
r.OpenSubKey("UserChoice", true); //at this step "Requested registry access is not allowed." exception occured