Click here to Skip to main content
16,022,296 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am using DXGI to capture the PPT screen and start PPT in the background by calling Microsoft.Office.Interop.PowerPoint. However, after PowerPoint.SlideShowSettings.Run() is executed, the PPT window will popup. I found it can be hidden again later, but how to make the opening process completely invisible to users.

What I have tried:

C#
PowerPoint.Application pptApp = new PowerPoint.Application();
//pptApp.Visible = Office.MsoTriState.msoTrue;
//pptApp.ShowWindowsInTaskbar = Office.MsoTriState.msoFalse;
//pptApp.Left = 0;

PowerPoint.Presentation oPre = pptApp.Presentations.Open("D:\\Document\\1.pptx", Office.MsoTriState.msoTrue, Office.MsoTriState.msoFalse, Office.MsoTriState.msoFalse);

PowerPoint.SlideShowSettings oSlideShowSettings = oPre.SlideShowSettings;
oSlideShowSettings.LoopUntilStopped = Office.MsoTriState.msoFalse;
oSlideShowSettings.ShowType = PowerPoint.PpSlideShowType.ppShowTypeWindow;
oSlideShowSettings.ShowWithNarration = Office.MsoTriState.msoFalse;
oSlideShowSettings.ShowWithAnimation = Office.MsoTriState.msoTrue;
oSlideShowSettings.AdvanceMode = PowerPoint.PpSlideShowAdvanceMode.ppSlideShowManualAdvance;
oSlideShowSettings.ShowScrollbar = Office.MsoTriState.msoFalse;

PowerPoint.SlideShowWindow oSlideShowWindow = oSlideShowSettings.Run();

int pptHwnd = pptApp.HWND;
IntPtr hPPTWnd = new IntPtr(pptHwnd);
ShowWindow(hPPTWnd, SW_HIDE);
Posted
Comments
ChandraRam 9-Sep-24 12:37pm    
The Application object has a Visible property that can be set - have you tried that?
ww Clt_ 9-Sep-24 22:07pm    
yes, i tried to set it to false, but when the program is running, it prompts "Hiding the application window is not allowed".

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900