Click or drag to resize
Ranorex

UtilRestartWithUiAccess Method

Restarts the current executable with UI access privileges. Those privileges are required to access Windows apps.

Namespace:  Ranorex.Core
Assembly:  Ranorex.Core (in Ranorex.Core.dll) Version: 12.7.4-git.38314c06
Syntax
public static int RestartWithUiAccess()

Return Value

Type: Int32
The exit code returned by the current executable.
Remarks
If the current process does not have UI access privileges, you can call this method to restart the current executable with UI privileges. The executable will be restarted using the Ranorex.UiaLauncher which thereby provides the required privileges to e.g. access Windows apps.
Examples
The following code checks for the privileges to access Windows apps and restarts the executable in order to get those privileges:
if (Ranorex.Core.Util.IsRestartRequiredForWinAppAccess)
    return Ranorex.Core.Util.RestartWithUiAccess();
See Also