I have read this and achieved the opening of my C# application. My C# application opens a folder and draws a graph. Is it possible for me to tell my C# application which folder
It certainly is possible.
The C++ CreateProcess() has a parameter called lpCommandLine
.
What you need to do in the C++ is to pass as lpCommandLine
a string that has the name of the folder that you want to open. You will need to enclose the string in double quotes if the folder path contains any spaces.
Inside your C# program you will have a static void Main(string[] args)
. The args
parameter will contain the folder name that you passed from the C++ program so that you can act on it appropriately.
For the C++ program to wait for the C# program to exit, it will need to use WaitForSingleObject()
to wait for it to exit, using the process handle returned from CreateProcess()
.
This is described here: http://www.codeproject.com/Tips/333559/CreateProcess-and-wait-for-result