Method call never returns

I am working with a COM component. There is a method that calls this call for the component and this method is used many times in my application, for every document processed this method is called.

One strange thing sometimes happens suddenly, it doesn't matter how many documents are processed, it can happen after 60, 100 or 300 documents are processed, or it just won't happen. Strange thing: component call doesn't return. The method remains stuck in the calling line. Do you know of any COM feature that can cause this problem?

0


source to share


1 answer


From your question, I understand that you are doing COM automation with docs. If your COM object is a document processing application (can MS Office guess correctly?), The application is probably just being blocked by a popup.

This phenomenon happens quite often when you automate, for example, Word or Excel. There are several things you need to do to get around this issue (I'm talking about MS Word here):



  • disable alerts by setting Application.DisplayAlerts accordingly
  • Install complete products to avoid Windows Installer pop-ups with missing features.
  • implement a timeout mechanism that will kill the application if any modal dialog asks for user input. The reason for this is that there are certain types of pop-ups that cannot be suppressed (if you need more information, please ask).
+1


source







All Articles