How do we do not to use TEXT() macro in coding visual c++ source but instead opt to either Unicode or Ansi option in settings of build configuration on Visual Studio 2017?
The point of TEXT() is to try to make the code work correctly regardless of how it was built, but if you know your project will always be built in either Unicode or multi-byte configuration, you can skip it and just use normal strings:
CreateFile(L"unicode_filename.txt", /*...*/);
CreateFile("ansi_filename.txt", /*...*/);
Personally, I think it's better to ignore that nonsense and just use the version of the function you want:
Whenever possible you should use the Unicode versions, because the behavior of the ANSI version depends on the locale the user has configured, and that can change the behavior of your program in surprising ways.