Hi, @Rodriguez, Daniel C [AUTOSOL/RS/MNL]
Have you read document: C4840. This warning is available beginning in Visual Studio 2017. The document also prodives samples and way to fix it:
For strings built and managed using CStringW, the provided operator LPCWSTR() should be used to cast a CStringW object to the C-style string pointer expected by the format string:
CStringW str1;
CStringW str2;
// ...
str1.Format("%s", static_cast<LPCWSTR>(str2));
Best regards,
Minxin Yu
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.