How to show a waiting dialog, in the meantime, still keep dealing with PowerPoint objects?

白昼怎懂夜的黑 提交于 2019-12-13 07:30:58

问题


I want to show a waiting dialog, in the meantime all the calculations concerning with PowerPoint objects still are running in the background. My purpose is during the time dealing with PowerPoint objects, I try to prevent the user from interfering with the UI.

It seems that there is no way to deal with PowerPoint objects in the background. Is there any workaround for my case?

Thanks

Note: I am using VS Ultimate 2013, C#, PowerPoint 2013, vsto


回答1:


Office applications use the single threaded apartment model. That's why you need to use the main thread for working with Office/PowerPoint objects. However, you can extract the required information into .Net collections and process the data on another thread.

But if you need to work with PowerPoint objects, a possible solution is to display a non-dialog form with a progress bar which display the state of your actions. Thus, end users will not be able to access the UI of PowerPoint. Don't forget to specify the parent window handle (PowerPoint window handle) for the Show method (see the IWin32Window interface).



来源:https://stackoverflow.com/questions/27291339/how-to-show-a-waiting-dialog-in-the-meantime-still-keep-dealing-with-powerpoin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!