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.
MainFrm: remove outdated UNREFERENCED_PARAMETER()
MainFrm: detect popup menu hiding more correctly

It generated false detection on ui preset change
MainFrm: reorder OnFilePostOpenmedia()

Fixes #3753
Resize on EC_VIDEO_SIZE_CHANGED only in MLS_LOADED

Should fix double resize when opening videos
Fix unchecked dynamic_cast warnings

CID 1130727-1130738
InfoBar: fix visual glitch on media change

Relayout() was doing nothing there
MainFrm: call RecalcLayout() where it makes sense

Eliminates visual glitch with InfoBar on media change