D
D
Denis Goncharenko2016-04-02 23:26:31
WPF
Denis Goncharenko, 2016-04-02 23:26:31

What's wrong with autorun?

The code:

string ExePath = System.Windows.Forms.Application.ExecutablePath;
if (String.IsNullOrEmpty((String)Registry.CurrentUser.GetValue(wigetName)))
{
    RegistryKey reg = Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run\");
    reg.SetValue(wigetName, ExePath);
    reg.Close();
}

The entry appears in the registry:
6b5b0b78819a44c0b4b88158de535733.jpg
The application is also displayed in startup. After the reboot, the process seems to hang if you look through the task manager, but the application window does not appear. Manually everything is normally started and works. Another such moment, yesterday I tried to add it to autoload, it worked, but an exception flew out and the program crashed (as it turned out, this is a common problem due to incorrectly written paths for files connected or used in the application). But today nothing happens at all.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Goncharenko, 2016-04-03
@denis79513

I found the problem, the bottom line is that for some reason the program stopped throwing exceptions, but simply crashes and closes immediately after autorun due to an error, although I did not handle these exceptions.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question