Hi @Christian_Schmitz, and sorry for bothering you again!
But maybe this question is interesting for others too, therefore here and not in a private support question:
I have to elevate a console helper when it’s being used by a Windows Desktop app, for which I am using WindowsShellExecuteAsAdminMBS. Works, but for some reasons I have to do this inside a cooperative Xojo thread, and I found I have to yield for a certain time or the elevated shell would be cancelled before finishing.
I am doing this with a repeated Thread.Yield, but how can I determine when I can finish the loop and continue with the rest of the mother thread? I don’t see a finished event or isRunning property. If I wait too long, app will look like stalled which gives no good user experience.
Or can I yield in a different way, neither stopping shell execution nor GUI?
Well, usually I would use the shell class (or one from the plugin) to get an event when the app is finished. See WindowsProcessMBS class and Terminated event.
You could also check process list regularly and see whether your app is still there. The ProcessMBS class may help here.
2 Likes
Thank you! Guess I’ll go with the ProcessMBS class.
1 Like