I finally tracked down the cause of a bug I complained about some time ago. Because the code currently liberally uses DoEvents throughout to keep the UI responsive, it introduces an entirely new set of bugs that are worse.

Here's an easy repro:
1. Misconfigure the web browser so it has the IE exe location but is set to try and find firefox.
2. Go to the web skin.
3. Hit the back button 3 times.

Expect:
First click is reacted to.

Actual:
Since the skin is busy waiting for the web browser to load (the newly extended 15 second wait), the click doesn't get acted upon but the button does highlight and the action is queued up. Now since nothing happened, the user clicks the button again. Nothing happens again. So they click it again. And so on. Finally RR gives up on waiting for the web browser to load and processes the large number of 'EXIT' actions on the queue and RR inexplicably exits entirely as each command barrels up the call stack until the app itself exits.

This is somewhat manufactured except that IE does take some time to start and for RR to see it so it is possible to hit this. And I was hitting this from time to time when I first started using RR and was having RR exit on my for no obvious reason.

I keep finding bugs that are caused by the use of DoEvents. In most of the cases, the use of DoEvents is almost entirely overkill and they can simply be removed with no noticable effect on the program. In other cases, they actually introduce worse bugs like this one. Another example of another bug I fixed by removing the DoEvents was in the skin show code - now my version of RR never shows stale data in lists/labels etc when you go to a new skin that then immediately updates to the correct data. I just see the correct data straight off. All I did was remove the repaint & DoEvents calls in the middle of the skin load.

I understand the desire to keep the UI responsive but there are better ways to do it targeting those cases where the app really is busy for a while. E.g. changing the app embedding code to use the timer to catch the window name and force it to the right size. In the meantime, the skin can be left to respond immediately to clicks rather than pretending to respond and letting the user shoot themselves in the foot.

Re-entrant UI only ever leads to subtle and frequently very nasty bugs even when the reentrancy isn't intended (e.g. a side effect of using COM). Using DoEvents is asking for trouble and has no real benefit since at best it hides a design flaw in the program.