I write a program to add parameters to the registry, but everything would not, everything turns out, it launched the 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 process an exception with an outflow of the message about the impossibility of adding a parameter. Help, the floor of the Internet did not understand.
Here is the source:
** {
Tregistry * reg = new Tregistry;
Reg- & gt; rootkey = hkey_current_user;
REG- & GT; OpenKey ("\ Control Panel \\ Desktop", True); // probably a string parameter
REG- & GT; WRITESTRING ("AUTOEMDTASKS", 2); // AUTO CLOSED PROGRAMM
REG- & GT; CloseKey ();
Application- & gt; MessageBox ("Parameter added, value 2", "Registry", MB_OK | MB_ICONINFORMATION);
DELETE REG;
exit;
} **
Answer 1, Authority 100%
something like this:
tregistry * reg = new tregistry;
Try.
{
Try.
{
Reg- & gt; rootkey = hkey_current_user;
REG- & GT; OpenKey ("\ Control Panel \\ Desktop", True); // Positioning
REG- & GT; WRITESTRING ("AUTOEMDTASKS", 2); // AUTO CLOSED PROGRAMM
REG- & GT; CloseKey ();
Application- & GT; MessageBox ("Starting," Registry ", MB_OK | MB_ICONINFORMATION);
}
Catch (...)
{
Application- & gt; MessageBox ("Chef, everything is lost !!!", "Kabzdent", MB_OK | MB_ICONSTOP);
}
}
__finally.
{
DELETE REG;
}