Process.Start never returns when UAC denied

后端 未结 1 766
误落风尘
误落风尘 2021-02-19 14:18

I have an updater exe that is meant to close the primary exe, replace it with an updated exe, and then launch that updated exe. When the updater attempts to start the updated ex

相关标签:
1条回答
  • 2021-02-19 14:45
       Process newProc = Process.Start(startInfo);
       MessageBox.Show("If this shows, the user has clicked YES in the UAC.");
    

    This is normal, the exception that's raised by Process.Start() will bypass the MessageBox.Show() call. It is a Win32Exception for Windows error code 1223, ERROR_CANCELLED, "The operation was cancelled by the user".

    Clearly you'll want to avoid swallowing exceptions here.

    0 讨论(0)
提交回复
热议问题