| is there a way for it to listen while it downloads for the 
| cancel event?
Your sub Cancel_Click should NOT exit, however, the exit statement is never
reached due to the return.
Return -1 is correct, this is how you tell the GUI to end the message loop.
Now the message loop exits back into your script from where it was called.
At this point, YOU must watch for the GUI to exit:

last if Win32::GUI::DoEvents() < 0;

instead of just Win32::GUI::DoEvents();

The chain goes:
1) you call Dialog() or DoEvents() inside GUI
2) GUI calls subs according to messages - like Cancel_Click when Exit button
is clicked.
3) your sub is active
4) your sub returns -1
5) GUI stops looking for messages and returns -1
6) your script continues

Have fun,
Harald

Reply via email to