문제

hey I'm trying to launch an app on the startup I have always done it just fine by using this code :

RegistryKey rkApp = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
if (rkApp.GetValue("Folder Locker") == null)
{
    rkApp.SetValue("Folder Locker", Application.ExecutablePath.ToString());
}

But now when I do this:

requestedExecutionLevel level="requireAdministrator" uiAccess="false" 

to start as administrator the app doesn't start on the start up I need help I hope it would be a small problem and not a big deal.

도움이 되었습니까?

해결책

You cannot get an application to run at logon that will elevate and somehow bypass the UAC dialog. That would pretty much defeat the purpose of UAC.

Your options include:

  • Accepting that the user will be prompted for elevation.
  • Modifying your application so that it does not require elevation. If some operations require elevation, then start a new elevated process to perform those tasks
  • Running your process as service in session 0 where UAC does not apply.
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top