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.
switch statements: Document intentional fall through.

Fixes CID 1130513 and 1130514.
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.
Use a bitcheck instead of casting (WIP).

Fixes CID #965944.