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

后端 未结 2 1363
死守一世寂寞
死守一世寂寞 2020-12-10 16:45

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 g

2条回答
  •  北海茫月
    2020-12-10 17:36

    We cannot pass argument dynamically to the full trust process. However, we can pass it using LocalSettings.

    1. Add the arguments to Local Settings and launch the full trust process: In C++:

      auto settings = Windows::Storage::ApplicationData::Current->LocalSettings; settings->Values->Insert("arg1", "val1"); settings->Values->Insert("arg2", "val2"); // Launch Full trust proc create_task(FullTrustProcessLauncher::LaunchFullTrustProcessForCurrentAppAsync()).then([](task t) {/* ... */});

    2. In the full trust process code,

      auto settings = Windows::Storage::ApplicationData::Current->LocalSettings; auto val1 = settings->Values->Lookup("arg1")->ToString();

提交回复
热议问题