question

JohnThomas-5774 avatar image
0 Votes"
JohnThomas-5774 asked ·

Using c++ .exe in c# UWP

Hi All,
I have a c# UWP and want to use c++ .exe with it. I have the source for the c++ .exe and have added this project to the c# sharp project. Do I need to WAP the c++ project and reference it, or can I launch a process from the c# UWP? The c++ .exe takes a command line argument after typing in the executable filename. I just want to click a button on the c#UWP and have it perform all the c++ .exe stuff. I don't want to install the c++.exe on the hard drive, since I have the source code and project in the solution, and I don't want to go to command prompt and type stuff in. How can I get the c# UWP to execute that project included in the solution. Again, it has one command line argument to go with the .exe name. I am not well versed in c++ and do not know how to change the console executable filecode. I only have the source code for the c++ to create an executable, and I know that works.

Thank you so much for your help, I really appreciate it.
JT

windows-desktop-bridge
· 5
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi, can the following method solve your problem?

0 Votes 0 ·

Hi, is there any update?

0 Votes 0 ·

Hi, do you have any questions?

0 Votes 0 ·

Hi, is there any update?

0 Votes 0 ·

Hi, is there any update? Have you solved your issue?

0 Votes 0 ·

1 Answer

FayWang-MSFT avatar image
0 Votes"
FayWang-MSFT answered ·

Hello,​

Welcome to our Microsoft Q&A platform!

After you add the .exe in the UWP project, you need to declare it in the manifest and also add the 'runFullTrust' capability in it. You can follow the steps below. About more details, you can refer to this similar thread.

1.Add "Windows Desktop Extensions" reference in the project. Right click the References-> Add Reference->Universal Windows->Extensions-> add Windows Desktop Extensions".

2.Open manifest, add Extensions tag and runFullTrust capability. Suppose you put the .exe in the assets directory. About the full content of manifest, you can view it from here.

3.When you click the button, use the following code to start your .exe.

 private async void Button_Click(object sender, RoutedEventArgs e)
 {
     await FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync();
 }


·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.