Use dynamic cast for AfxGetMainFrame() macro

AfxGetMainWnd() returns the active window when no thread window is set

Fixes #3749
Make auto-hide controls code compatible with d3dfs
Make auto-hide windowed mouse pointer optional

Fixes #3750
Controls: add missing call to call RecalcLayout()
Fix uninitialized field warnings

CID 966343, 1130515
Cosmetic: Refactor CPolygon::GetLONG for clarity.

Fixes #966539.
Avoid possible null dereferences.

Fixes CID 965991, 965992.
Remove some useless null checks.

Fixes CID 966174.
Add asserts for normally unattainable default in switch.

Fixes CID 965933, 965939, 965947, 965948.
Cosmetics: Use CheckPointer.
Use UINT_MAX/DWORD_MAX/DWORD_ERROR when it makes sense to do so.
Use conversion constructors to work-around confusing AStyle styling.
Fix a crash when using the options dialog opened from the command-line.

347e8bb4919e5257897edc70ab29ef98563a0687 forgot to add the needed null-check to filter out the cases where the active window was returned.
Update to astyle v2.04.
Move old changelog entries to Changelog_old.txt.
Use a line break before and after functions.