Home c++ Exception: Failed to Set Data For

Exception: Failed to Set Data For

Author

Date

Category

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;
}

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions