Alaska Software Inc. - Runshell cannot run a program that requires elevation.
Username: Password:
AuthorTopic: Runshell cannot run a program that requires elevation.
Itai Ben-ArtziRunshell cannot run a program that requires elevation.
on Tue, 20 Oct 2015 19:47:11 -0700
If RunShell() calls a program that requires elevation (usually a popup from 
the User-Account-Control), the xBase application crashes.  RunShell() should 
allow the Windows pop-up (do you want to allow this program) to be displayed 
instead of shutting down the application.
Can this be fixed?
Is there a work-around this problem?

Many thanks,
-Itai
Andreas Gehrs-Pahl
Re: Runshell cannot run a program that requires elevation.
on Wed, 21 Oct 2015 16:56:25 -0400
Itai,

>If RunShell() calls a program that requires elevation (usually a popup from 
>the User-Account-Control), the xBase application crashes.  RunShell() should 
>allow the Windows pop-up (do you want to allow this program) to be displayed 
>instead of shutting down the application.
>Can this be fixed?

I haven't ever encountered this kind of problem. It works fine for me with 
all Xbase versions on Windows 7 (the only OS with UAC that I can test on). 
Can you specify what Xbase++ version and OS version you use, and what the 
error message or issue is? What programs do you call? Any example code?

If you try to run an application that needs elevation and you deny the 
program to run -- selecting the [No] button on the pop-up dialog, RunShell() 
will return an OS error -- 1223 "The Operation was canceled by the user" -- 
but you can just [Ignore] that error.

>Is there a work-around this problem?

You can always use the ShellExecuteA function of the OS directly, but that 
won't allow you to run the programs asynchronously (at least not without a 
lot of extra work).

Or you can enclose the RunShell() function within a Sequence and ignore any 
runtime errors that way.

Hope that helps,

Andreas

Andreas Gehrs-Pahl
Absolute Software, LLC

phone: (989) 723-9927
email: Andreas.GP@Charter.net
web:   http://www.Aerospace-History.net
Itai Ben-ArtziRe: Runshell cannot run a program that requires elevation.
on Wed, 21 Oct 2015 20:39:47 -0700
Andreas,
Try to activate the User-Account-Control and invoke executable from within 
RunShell (e.g. RunShell( "", “Test.exe”, .T. ) ).
It does not work on my Win-7.

-Itai
Andreas Gehrs-Pahl
Re: Runshell cannot run a program that requires elevation.
on Thu, 22 Oct 2015 01:44:02 -0400
Itai,

>Try to activate the User-Account-Control and invoke executable from within 
>RunShell (e.g. RunShell( "", “Test.exe”, .T. ) ).
>It does not work on my Win-7.

As I said, this works fine for me. If I allow the rights elevation, the 
other application is started, while the first one continues to work just 
fine. If I refuse the rights elevation, the other application is not 
started, and an OS Runtime Error is raised: 1223 -- "The Operation was 
canceled by the user", which can be Ignored, after which the original 
application continues to run without any issues.

But, if you don't need asynchronous behavior, as indicated above, you could 
try using the ShellExecuteA() API function instead, and see if this works 
better for you.

Can you post some actual code that produces the error? What error is raised? 
What Xbase++ version do you use? Have you tried without UAC? Have you tried 
to start a different application (that requires rights elevation)? Have you 
tried it on a different computer?

The problem is probably not RunShell(), but something else you are doing.

Andreas

Andreas Gehrs-Pahl
Absolute Software, LLC

phone: (989) 723-9927
email: Andreas.GP@Charter.net
web:   http://www.Aerospace-History.net