Please read my article on the MSDN Magazine 2016 September issue for detailed information on the subject and modern C++ code uage as well:
“Unicode Encoding Conversions with STL Strings and Win32 APIs”
C++ code based on that article is available on GitHub here as well.