Programming Tips - Microsoft Visual C++: here is how to disable warning C4996

Date: 2023jan3 Product: Visual C++ Keywords: depreciated Q. Microsoft Visual C++: here is how to disable warning C4996 For example:
warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead.
Or
warning C4996: 'strnicmp': The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _strnicmp. See online help for details.
A. Adding this to stdafx.h does NOT work:
#pragma warning(disable: 4996)
What did work for me was adding this at the very top of stdafx.h (Even before including windows.h or stdio.h - in fact this may be key)
#define _CRT_SECURE_NO_WARNINGS #define _CRT_NONSTDC_NO_DEPRECATE