I am writing a program to add parameters to the registry, but it wouldn’t be anything, everything works, then I run an antivirus and access to the registry through the program was closed and I have an exception -
Project Project1.exe raised exception class ERegistry with message 'Failed to set data for' HungAppTimeout '. Process Stopped. Use Step or Run to continue.
How to handle an exception with the output of a message about the impossibility of adding a parameter help, I did not understand the floor of the Internet.
Here is the source:
**{ TRegistry *reg=new TRegistry; reg->RootKey=HKEY_CURRENT_USER; reg->OpenKey("\Control Panel\\Desktop",true); // Навернека строковый параметр reg->WriteString("AutoEndTasks", 2); // Auto closed programm reg->CloseKey(); Application->MessageBox("Параметр добавлен, значение 2 ", "Registry", MB_OK | MB_ICONINFORMATION); delete reg; exit; }**
"\Control Panel\\Desktop"
\ C means something completely different. It must be either"Control Panel\\Desktop"
or"\\Control Panel\\Desktop"
. But my comment will be ignored again. - KoVadim