Click here to Skip to main content
15,166,728 members

Comments by Dean Roddey (Top 1 by date)

Dean Roddey 18-Apr-19 14:54pm View
   
Cast it to a (BYTE*) when you pass it into the API which is expecting an array of bytes. After it is filled in, and you look at it via the TCHAR pointer, then it will be correct. OR, keep it a BYTE* type array, and then cast it to a TCHAR to look at it afterwards, one way or another.

const TCHAR* realName = reinterpret_cast<const TChar*>(friendlyName);

realName will then be looking at the buffer via the correct type and should work correctly.

Of course be sure to clean up the buffer at some point.