Visual C++ でアプリケーションを作成しました (コマンド ラインを使用します)。ユーザーがコマンドラインを使用する必要がなく、GUI から実行できるように、Visual C# で同じ GUI を作成しました。では、同じインストーラーを作成するにはどうすればよいでしょうか。GUI には、アプリケーションを呼び出して実行する次のコードがあります。
string cmdText;
cmdText = @"C++HeaderConversionToQFASTXML.exe " + " " + textBox1.Text + " " + textBox2.Text;
ProcessStartInfo info = new ProcessStartInfo("cmd.exe");
info.UseShellExecute = false;
info.RedirectStandardInput = true;
info.RedirectStandardOutput = true;
info.CreateNoWindow = true;
info.WorkingDirectory = @"C:\forAbishek\C++HeaderConversionToQFASTXML\Release\";
Process p = Process.Start(info);
p.StandardInput.WriteLine(cmdText);
この場合、作業ディレクトリを、.exe (C++HeaderConversionToQFASTXML.exe) がユーザーのマシンに存在するディレクトリにする必要があります。GUI がこれを確実に取得するにはどうすればよいですか? .exe がユーザーのマシンにインストールされます。誰かが私を助けることができますか?ありがとうございました。
次の変更を行いました。
string cmdText;
cmdText = @"C++HeaderConversionToQFASTXML.exe " + " " + textBox1.Text + " " + textBox2.Text;
ProcessStartInfo info = new ProcessStartInfo("cmd.exe");
info.UseShellExecute = false;
info.RedirectStandardInput = true;
info.RedirectStandardOutput = true;
info.CreateNoWindow = true;
String path = System.Reflection.Assembly.GetExecutingAssembly().Location;
path = System.IO.Path.GetDirectoryName(path);
Directory.SetCurrentDirectory(path);
MessageBox.Show(path);
info.WorkingDirectory = path;
Process p = Process.Start(info);
p.StandardInput.WriteLine(cmdText);
まだ機能していません。どこが間違っていますか?