เอ่อ เข้าใจอะไรผิดหรือป่าว ปกติแล้ว CString จะเก็บ TCHAR ซึ่ง TCHAR จะสามารถเป็นได้ทั้ง unicode และ ascii ขึ้นอยู่กับว่า compile เป็นแบบไหน โดยการกำหนด preprocessor (Project -> Settings)
ถ้าต้องการให้เป็น unicode ก็ define _UNICODE ถ้าไม่มีก็จะเป็น ascii
Code:
CString str = _T("Test String"); // use macro _T for assign tchar string
LPCTSTR szString = (LPCTSTR) str;
แต่ถ้าอยากจะ convert Unicode -> Ascii หรือ Ascii-> Unicode ก็สามารถทำได้ไม่ยากดัง code ข้างล่าง
**Hidden Content: To see this hidden content your post count must be 1 or greater.**