I am working on my first C# application. I am trying to open a PowerPoint file in fullscreen mode. The code requires cmd arguments. I placed my powerpoint test.pptm in the same folder as the output (debug and release) for my application. I have written the following code:
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.CreateNoWindow = false;
startInfo.UseShellExecute = false;
startInfo.FileName = "powerpnt.exe";
startInfo.WindowStyle = ProcessWindowStyle.Hidden;
startInfo.Arguments = "/s test.pptm";
try
{
using (Process exeProcess = Process.Start(startInfo))
{
exeProcess.WaitForExit();
}
}
catch
{
}
The code compiles, but when I try to run this code via a button, the console states:
Exception thrown: 'System.ComponentModel.Win32Exception' in System.dll
I've tried to directly reference the pptm file by changing the following line:
startInfo.Arguments = "/s c:\path\to\full\file\test.pptm";
I get an error stating Unrecognized escape sequence. Has anyone experienced this before? I've been stuck on this for a little while. Thanks!
startInfo.Arguments = "/s ""c:\path\to\full\file\test.pptm""";- Paulo LimaException thrown: 'System.ComponentModel.Win32Exception' in System.dll. The program seems to have the proper command needed, but it can't execute it. - Alex Weber