Dearest Monks,

I'm creating a Win32::GUI application - it's a customised setup utility for a game modification. Part of the application downloads a small text file from a web server; this text file acts as an index, and stores web addresses of mirror servers containing the game mod files that have to be downloaded and installed on the user's computer. The application then looks for a small text file on each of the mirror servers contained in the index, basically to check that they're responsive and can actually be used by the user. I'm using LWP::UserAgent to achieve all of this and it works rather nicely. While this process is taking place, an animated throbber is shown on-screen with various status/progress messages telling the user what is happening, and a "Cancel" button in case the user wants to close the application while the process is running.

This is no problem if the index server and mirror servers are all functioning correctly, because the process takes a few seconds. However, if a couple of the servers are unavailable, it can lengthen the process considerably (maybe by 20 seconds or so) and during that time the GUI is unresponsive and appears to have frozen or crashed: large parts of the GUI, such as all graphics and some labels, appear grey, and repeated clicks will result in the standard Windows "Not Responding" window appearing. The GUI appears normal and becomes responsive again when the process has finished. I believe that this is because Win32::GUI::DoEvents() hasn't been called for a while. The trouble is, the application will be used by less-advanced computer users who might mistake this for an actual crash and close the application, then complain to me that it doesn't work. :)

I've tried a number of different methods to keep the GUI responding:

Part of the problem lies with the fact that I have to support almost every version of Windows with this application; it has to work with 98/ME/2000/XP/2003, so a lot of the nice XP/2K-only solutions are cruelly snatched away from me.

My question, simply, is this: is there any way I can run the process I described while keeping the GUI responsive at the same time?

Any help, advice or comments are most welcome. Thank you! :)

In reply to Keeping a Win32::GUI interface responsive while executing other code? by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.