Hi All
I want to
integrate an “.exe” program in my application but I don’t know how to do that!
The .exe
program is a decryption program that needs a password to decrypt files.
Also if it’s
possible that I send directly the output (decrypted file) into my application
not into a file.
Regard.
Mourad ReporterPosted Feb 5, 2008, 4:05 AM
AlanPosted Feb 2, 2008, 8:22 AM
One approach you could look at is to use the System.Diagnostics.Process class to call the .exe and redirect the output so that it is captured by your C# program.
Here's some basic code to do this:
Process proc = new Process(); lines = new List();
proc.StartInfo.FileName = "whatever.exe";
proc.StartInfo.Arguments = "password";
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.RedirectStandardOutput = true;
proc.Start();
List
string line;
// read and store lines from redirected standard output
while ((line = proc.StandardOutput.ReadLine()) != null)
{
lines.Add(line);
}
proc.WaitForExit();
// process output