none
OLEMessageFilter and Word Automation RRS feed

  • Question

  • I have a desktop application that does a significant amount of Word and PowerPoint automation. I was running into RPC_E_CALL_REJECTED errors so I implemented the OLEMessageFilter to handle those.

    My question is this.  In the examples I've seen, the code to register and revoke the MessageFilter looks like this:

    OleMessageFilter.Register()
      ' Make COM calls here....
    OleMessageFilter.Revoke()

    How much or little code can actually live between the Register and Revoke?  For instance, can I register the register the filter when my application starts up and revoke it at shutdown?  Or should it be registered and revoked only in routines where automation code is actually running?

    Thanks for some insight.

    Friday, February 6, 2015 9:03 PM

Answers

  • Hi S.Bashaw,

    Based on the descrition, you were automating Word and PowerPoint application and got RPC_E_CALL_REJECTED error message.

    Would you mind sharing with more detail about the secnrio you were handing? Can you get the Office application object successfully and which line of code caused this error? Also could this error be reproduced everytime? If yes, a piece of code is appreciate.

    >>How much or little code can actually live between the Register and Revoke?  For instance, can I register the register the filter when my application starts up and revoke it at shutdown?  Or should it be registered and revoked only in routines where automation code is actually running?<<

    It seems that you are interested in using IOleMessageFilter, I suggest that you reopen a new thread based on which language you are using.

    Also here is a link for a similar topic for your reference:
    https://msdn.microsoft.com/en-us/library/ms228772.aspx

    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, February 9, 2015 5:26 AM
    Moderator