Downloaded and tested SkyKhan's code, it works but nothing happens if I click the minimize button. Tested Raw's version too, I can see the clicking effect of the minimize button, but still nothing happens.
Although not working perfectly, but still many nice tricks I can learn from the codes. Thanks for sharing.