So, in the registry after the program starts, an entry remains in the section with the full name:

(HKEY_USERS\S-1-5-21-3007851985-1594028022-4212282107-1000_Classes\Local Settings\Software\Microsoft\Windows\Shell\MuiCache) 

I need to delete this entry when closing the program. The program is written in Visual Studio 2010 on with ++. I wrote the code, but it does not delete this entry. What's wrong with it?

 RegistryKey^ rk; String^ fullPath = Application::ExecutablePath->ToString(); rk = Registry::Users->OpenSubKey("S-1-5-21-3007851985-1594028022-4212282107-1000_Classes\Local Settings\Software\Microsoft\Windows\Shell\MuiCache"); if (rk) rk->DeleteValue(fullPath); 

    1 answer 1

    Most likely the problem is that you forgot to escape slashes in the string. The right way:

     "S-1-5-21-3007851985-1594028022-4212282107-1000_Classes\\Local Settings\\Software\\Microsoft\\Windows\\Shell\\MuiCache" 

    Newbies often encounter a similar problem when opening files under Windows when they forget to escape slashes in the file paths.

    • You are right, I added ecroning slash, now I get a System.UnauthorizedAccessException error. Maybe you know how to fix it? ___ That's all, thanks for the help, I managed with your help) - Kitty2312