Win32 UI: Major code cleanups.

Nothing should be functionally different, but it was in desperate need of some love...

Please give this request a thorough look over before merging.