폼에 하나의 버튼과 하나의 텍스트 상자가 있습니다. 버튼을 클릭하면 Microsoft Word가 시작됩니다. 사용자가 Word를 닫으면 사용자가 자신의 작업을 저장 한 파일 이름을 텍스트 상자에 표시하려고합니다.사용자가 Word를 닫을 때 파일 이름을 가져 오는 방법은 무엇입니까?
나는 button_click에 대해 다음 코드를 사용하고 있습니다 :이 명령 줄을 통해 가능하다 생각하지 않는다
System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo(@"C:\Program Files\Microsoft Office\Office12\winword.exe");
psi.RedirectStandardOutput = true;
psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
psi.UseShellExecute = false;
System.Diagnostics.Process listFiles;
listFiles = System.Diagnostics.Process.Start(psi);
System.IO.StreamReader myOutput = listFiles.StandardOutput;
listFiles.WaitForExit();
if (listFiles.HasExited)
{
System.IO.FileInfo ff = new System.IO.FileInfo(myOutput.ToString());
string output = myOutput.ReadToEnd();
this.processResults.Text = output;
}