No announcement yet.

Installer not repainting while waiting for external apps

This topic is closed.
  • Filter
  • Time
  • Show
Clear All
new posts

  • Installer not repainting while waiting for external apps

    While running my install, it appears as if the installer is unable to repaint/refresh its display panels. It looks like its not responding to Windows messages.

    This occurs when using the Execute Program feature under Shell Operations. It is most noticeable when launching a console application and the 'Wait for program to end before continuing' box is checked.

    Is this a known isssue, or I'm I using the 'Execute Program' feature incorrectly? Please let me know how if there's something I can do to prevent this behavior.

    John L. Schacher
    Dir. Product Development
    Sailwest Computing
    [email protected]

  • #2
    Re: Installer not repainting while waiting for external apps

    Thanks Ted, and I have a suggestion that may help.

    I'm assuming that SUF is using the Win32 API WaitForSingleObject(hApp...) to determine when the program is finished executing. As you know, this function is synchronous and will prevent the current thread from processing any messages until it returns. If this is the case then there are a few ways this can be fixed.

    The best way I know in fixing this problem is to use MsgWaitForMultipleObjects() in a loop. When given QS_ALLEVENTS as the wake mask, this function will return when either the external app has terminated or when a message is waiting in the queue. If it's a message, You can then pump the message queue with PeekMessage(PM_REMOVE)... Translate/DispatchMessage() for processing and then loop back to call MsgWaitForMultipleObjects() again.

    rocessing the queue is especially important when COM is used within your app (I'm assuming SUF calls CoInitialize()) because the COM subsystem creates a hidden window to be used as the dispatcher for calling methods. This hidden window needs to be able to process the events.

    Here's a reference to a Microsoft Developer Network article that contains sample code and a better explanation, Q136885 - "INFO: OLE Threads Must Dispatch Messages".

    I've ran into this sort of thing many times in the past and would be happy to provide additional assistance.

    Once again, the above solution will only work if my original assumption of the SUF source is correct. If I'm mistaken, then my appologies for taking your time.

    [This message has been edited by John Schacher (edited 05-10-2000).]


    • #3
      Re: Installer not repainting while waiting for external apps

      You are correct that the setup.exe is not responding to Windows messages while waiting for your external process to finish. Unfortunately, the API call "blocks" the calling app while waiting for the other process to terminate. The setup runtime can't really do anything about this, so paint messages are not received. Turning off the 'Wait for program to end before continuing' option makes the problem go away.

      If anyone has a suggestion as to how this could be avoided, we'd love to hear it!


      • #4
        Re: Installer not repainting while waiting for external apps

        John, I appreciate the suggestions. You are correct in your various assumptions, so I will certainly look into it. I'll post my results here when I'm done. Give me a week or so, as I've got a handfull of other things to get to as well!