Problem while executing pps file from C#
-
Hi, I am executing a PowerPoint slide show file (.pps) from my C# source code using:
System.Diagnostics.Process extProcess = System.Diagnostics.Process.Start("xdsfr.pps");
extProcess.WaitForExit();The problem here is my source code immediately continues to execute and does wait for PowerPoint to exit. It seems that somehow extProcess receives "Exit" event from PowerPoint (although PowerPoint is still operating.) Because when I check for "HasExited" property of extProcess while debugging I can see it as "true". Googling about the issue gave me nothing. If you guys can give me a hint, it is appreciated. Thank you for your time, Regards,
Always keep the Murphy Rules in mind!
-
Hi, I am executing a PowerPoint slide show file (.pps) from my C# source code using:
System.Diagnostics.Process extProcess = System.Diagnostics.Process.Start("xdsfr.pps");
extProcess.WaitForExit();The problem here is my source code immediately continues to execute and does wait for PowerPoint to exit. It seems that somehow extProcess receives "Exit" event from PowerPoint (although PowerPoint is still operating.) Because when I check for "HasExited" property of extProcess while debugging I can see it as "true". Googling about the issue gave me nothing. If you guys can give me a hint, it is appreciated. Thank you for your time, Regards,
Always keep the Murphy Rules in mind!
I guess that when new process is started it calls another executable file and passes xdsfr.pps as an argument to it and the process itself exits so that's why your code doesn't stop. If my assumption is correct then you can try to find out which executable is being called and call it yourself or you can try if this helps: Using WMI to monitor process creation, deletion and modification in .NET[^]
Giorgi Dalakishvili #region signature My Articles / My Latest Article[^] / My blog[^] #endregion
-
Hi, I am executing a PowerPoint slide show file (.pps) from my C# source code using:
System.Diagnostics.Process extProcess = System.Diagnostics.Process.Start("xdsfr.pps");
extProcess.WaitForExit();The problem here is my source code immediately continues to execute and does wait for PowerPoint to exit. It seems that somehow extProcess receives "Exit" event from PowerPoint (although PowerPoint is still operating.) Because when I check for "HasExited" property of extProcess while debugging I can see it as "true". Googling about the issue gave me nothing. If you guys can give me a hint, it is appreciated. Thank you for your time, Regards,
Always keep the Murphy Rules in mind!
-
I suspect its because you are not really executing xdsfr.pps, under the hood you are executing POWERPNT.EXE and passing the file name to it. Try executing POWERPNT.EXE and passing the file name as a parameter.
Bob Ashfield Consultants Ltd
Thanx for the suggestion Bob, Tried:
extProcess = System.Diagnostics.Process.Start("POWERPNT.EXE", filename);
and result is the same. I will go with Giorgi's suggestion and see if it helps. Thank you both guys.
Always keep the Murphy Rules in mind!
modified on Wednesday, October 22, 2008 6:48 AM
-
Thanx for the suggestion Bob, Tried:
extProcess = System.Diagnostics.Process.Start("POWERPNT.EXE", filename);
and result is the same. I will go with Giorgi's suggestion and see if it helps. Thank you both guys.
Always keep the Murphy Rules in mind!
modified on Wednesday, October 22, 2008 6:48 AM
You need to use the proper command line arguments: http://pptfaq.com/FAQ00528.htm[^]
Regards, Thomas Stockwell Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. Visit my Blog
-
Hi, I am executing a PowerPoint slide show file (.pps) from my C# source code using:
System.Diagnostics.Process extProcess = System.Diagnostics.Process.Start("xdsfr.pps");
extProcess.WaitForExit();The problem here is my source code immediately continues to execute and does wait for PowerPoint to exit. It seems that somehow extProcess receives "Exit" event from PowerPoint (although PowerPoint is still operating.) Because when I check for "HasExited" property of extProcess while debugging I can see it as "true". Googling about the issue gave me nothing. If you guys can give me a hint, it is appreciated. Thank you for your time, Regards,
Always keep the Murphy Rules in mind!
Thomas, thank you for your suggestion, I have tried the command line arguments but still my code does not wait for PowerPoint to exit. Giorgi, I have modified and used the code that you have linked. But the Process that executes the pps file exits in no time, I could not catch any of the events through POWERPNT.exe when I added to ProcessWatcher. I also tried to watch my own executable but it did not fire events too. I am not sure if I did all correctly I will keep trying for while. Funny (or should I say sad for me) I am using the same method with Visio, but the code executes just as I have expected. When I call "xdsfr.vsd" (which I have exported in previous operations) my executable hangs up operation and waits until Visio exits...
Always keep the Murphy Rules in mind!
modified on Wednesday, October 22, 2008 10:18 AM
-
Hi, I am executing a PowerPoint slide show file (.pps) from my C# source code using:
System.Diagnostics.Process extProcess = System.Diagnostics.Process.Start("xdsfr.pps");
extProcess.WaitForExit();The problem here is my source code immediately continues to execute and does wait for PowerPoint to exit. It seems that somehow extProcess receives "Exit" event from PowerPoint (although PowerPoint is still operating.) Because when I check for "HasExited" property of extProcess while debugging I can see it as "true". Googling about the issue gave me nothing. If you guys can give me a hint, it is appreciated. Thank you for your time, Regards,
Always keep the Murphy Rules in mind!
I have found the error. And it is not related to the code that I have given. For anyone who encounters the same mistake, here is my experience: Since I use the POWERPNT.EXE in my previous operations, the Process for this executable is not properly disposed thats why I can still see the POWERPNT.EXE in my TaskManager/Processes tab. (This happens before the code in above posts is executed.) Thats why when my code executes it seems that it cannot attach itself to POWERPNT.EXE. When I managed to dispose POWERPNT.EXE process before executing the code, everything worked just fine. :cool: Thanks for help guys, Regards
Always keep the Murphy Rules in mind!