Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
722 views
in Technique[技术] by (71.8m points)

windows 10 - How to launch a full-trust (desktop bridge) app from UWP with arbitrary parameters

Is it possible for a UWP app to launch its Desktop Bridge (full-trust application component) with arbitrary command-line arguments? I see the ability to specify "argument groups" (see https://docs.microsoft.com/en-us/uwp/api/Windows.ApplicationModel.FullTrustProcessLauncher), but it looks like that only supports using a predefined ParameterGroup. I need to launch a UWP with programmatically-determined (at launch time) arbitrary command-line arguments. Is this possible, and if so, how?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

No this is not possible today.

One quick way to accomplish the scenario is to have the UWP write the command string to the local app data/settings, which is shared between the two processes. So the full-trust process can then pick up the command string after its been launched from there.

A more complex solution is to establish an app service connection between the two processes, and pass the command string via that connection. This will be helpful if you need to keep communicating back and forth between the two processes.

If for some reason you can't change your existing full-trust process code, you could add an extra EXE to your package that just reads the command string from the app data and then launches your actual full-trust EXE with those parameters (using Process.Start() or something equivalent).

EDIT I have posted some more details and an example on my blog: https://stefanwick.com/2018/04/06/uwp-with-desktop-extension-part-2/


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...