Be consistent with function's variables.
Fix possible NULL pointer dereference.
include/atl: remove extra arguments from format strings and use the right field type specifier.
Use the right field type specifier in function calls.

(/analyze warning C6340)
Cosmetics: Remove useless AfxGetMyApp().
MiniDump: Code simplification.