LPCTSTR
type-casting is just wrong. You may want to use an ATL conversion helper like CA2T
to convert from char
string to TCHAR
(LPCTSTR
) string, or CA2W
to convert from char
string to Unicode UTF-16 wchar_t
string; e.g.:
// CA2T - Uses the TCHAR model (obsolete)
ListBox.AddString( CA2T(Adapter_List->pScanList->network[0].szSsid) );
or:
// CA2W - Conversion to Unicode UTF-16 (wchar_t) string
// More modern approach.
ListBox.AddString( CA2W(Adapter_List->pScanList->network[0].szSsid) );
But, more important, what is the encoding used by your char szSSid[]
string? You may want to specify that encoding identifier (e.g. CP_UTF8
for UTF-8 strings) to CA2W
constructor nCodePage
parameter for proper conversion to Unicode UTF-16 string passed to AddString()
method.