Home > OS >  controling another program in c# (filedialogs)
controling another program in c# (filedialogs)

Time:08-29

so i have a program (witch is written in c ). what this program do is that it get the location of 2 file using filedialogs, edit them then give you an result file. i want to write c# program to control that. what i mean by control is that i want to open the app, then give it 2 locations, then get the output file and save it in a third location.

here is the program and its source code if it helps : http://modderbase.com/showthread.php?tid=17 it's for renaming uasset files

btw i tried rewriting the whole thing in c# but i don't understand c so yeeeeeeah.

also if you anyone know how to write the core part of the program in c# i would appreciate it.

sorry about my English. it's my second language

CodePudding user response:

If you read the c code, in the _tmain function it specifies in a comment that the dialogs only appear if the program is run without arguments.

You can run an application with c# and passing arguments

(From MSDN)

 // Start the child process.
 Process p = new Process();
 // Redirect the output stream of the child process.
 p.StartInfo.UseShellExecute = false;
 p.StartInfo.RedirectStandardOutput = true;
 p.StartInfo.FileName = "UassetRenamer.exe"   " fisrtFilePath "   "SecondFilePath";
 p.Start();
 string output = p.StandardOutput.ReadToEnd();
 p.WaitForExit();
  • Related