> to user input. What I think you need to do is disable any user input > controls that might cause problems if they are clicked while you're > downloading, fork, have the child download, the parent return > to the when > the child has finished get it to re-enable the controls, eg
You can also do a simple form of preemptive multitasking. Somewhere in the innermost loop of your script, do a Win32::GUI::DoEvents(); That fires all pending events and doesn't do much harm performance-wise if there aren't any. You need to consider a few things, though - like somebody trying to exit your main window, in which case DoEvents returns -1. You would have to abort everything and then return -1 from the handler that hosts the DoEvents, so that this in turn ends the Win32::GUI::Dialog(); loop. Or pop up a messagebox, saying that exiting isn't possible until the download is done. Anyway, DoEvents is the equivalent of Yield() and gives you the chance to react to users clicking away while the script is busy, without any forking or spawning. There have been samples on this list and I'm sure I got this somewhere in my stuff @ http://www.fairymails.com/perl/ - I can dig it up if you're interested. Have fun, Harald