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

  • Question

  • 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


    • Edited by chipbk11 Thursday, December 4, 2014 10:12 AM
    Thursday, December 4, 2014 10:12 AM

Answers

  • Hi Chipbk11,

    >>How can you hide the PowerPoint Application? I use the following piece of codes, but get error "hiding the application window is not allowed"

    PowerPointApp.Visible = Microsoft.Office.Core.MsoTriState.msoFalse<<

    Sorry for the misleading, I also could reproduce this issue. It seems that we can't hide the applicaiton from the add-in.

    As a workaround, I suggest that you close the presentation and then reopen it without window. We can use Presentations.Open to open a presentation and pass the WithWindow with false.

    >>It's better to lock the PowerPoint Application, but I know that there is no such function.<<

    If you have any feedback about Office produce, I suggest that you submit them from link below:
    Submit Feedback - Microsoft Office

    Regards & Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Monday, December 8, 2014 9:47 AM
    Moderator

All replies

  • 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 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).


    Thursday, December 4, 2014 10:47 AM
  • Thanks for your response. However, I still get confused with your 2nd idea. If I show a dialog form (on the main UI), I need to wait until the dialog form is closed in order to do my calculation concerning PowerPoint objects on the main UI as well. Look, the following piece of code will explain it better:

    Form dialogForm = ....

    dialogForm.ShowDialog();

    //- dealing with PowerPoint objects

    DealWithPowerPointOjbects();

    dialogForm.Close();

    The function DealWithPowerPointObjects is never called until you close the dialogForm. Because all of them (dialogForm && DealWithPowerPointObjects) must run on the main thread. 

    My conclusion is there is no way to show a waiting (or progress bar) dialog on the main thread, and push all PowerPoint objects dealing in the background.

    Thanks.

    Thursday, December 4, 2014 11:08 AM
  • You need to use the Show method, not ShowDialog. I will correct my message.
    Thursday, December 4, 2014 12:25 PM
  • However, when you use the Show method, you still allow user to select the PowerPoint application, because the dialog form is not a modal dialog.
    Thursday, December 4, 2014 12:26 PM
  • Nope. Did you try to specify the parent window handle to Show method?
    Thursday, December 4, 2014 1:43 PM
  • I have tried. And the user still is able to interact with the PowerPoint application, which is located under the DialogForm. Again, the dialog form here is not the modal dialog.

    Thursday, December 4, 2014 1:53 PM
  • There is no other way. You may consider running a long-running task on another thread (of course, without involving PowerPoint objects).

    Thursday, December 4, 2014 2:09 PM
  • Hi chipbyk,

     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?

    If I understood correctly, you can hide the PowerPoint application when you show the modaless diaog and show the application after user close the dialog as a workaround.

    Regards & Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, December 5, 2014 2:33 AM
    Moderator
  • How can you hide the PowerPoint Application? I use the following piece of codes, but get error "hiding the application window is not allowed"

    PowerPointApp.Visible = Microsoft.Office.Core.MsoTriState.msoFalse


    It's better to lock the PowerPoint Application, but I know that there is no such function.


    • Edited by chipbk11 Friday, December 5, 2014 8:50 AM
    Friday, December 5, 2014 8:34 AM
  • Hi Chipbk11,

    >>How can you hide the PowerPoint Application? I use the following piece of codes, but get error "hiding the application window is not allowed"

    PowerPointApp.Visible = Microsoft.Office.Core.MsoTriState.msoFalse<<

    Sorry for the misleading, I also could reproduce this issue. It seems that we can't hide the applicaiton from the add-in.

    As a workaround, I suggest that you close the presentation and then reopen it without window. We can use Presentations.Open to open a presentation and pass the WithWindow with false.

    >>It's better to lock the PowerPoint Application, but I know that there is no such function.<<

    If you have any feedback about Office produce, I suggest that you submit them from link below:
    Submit Feedback - Microsoft Office

    Regards & Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Monday, December 8, 2014 9:47 AM
    Moderator