This example has problems if the window is closed from either a minimized or maximized state. I haven't investigated but I think it's saving the current position even if it's minimized or maximized.
Then if the window opens minimized clicking Restore doesn't do anything similarly if the window opens maximized clicking the restore icon doesn't do anything either...
The example does demonstrate the registry use which I suppose is the point. Though for window settings I expected a handy object that did something matching this C++:
// Store window size and position in the registry to be used on opening again.