1
을 PCWSTR하는 CString을 변환하는 방법 :나는 다음과 같은 방법을 한
VariantFromString(strXMLPath ,vXMLSource);
및 방법의 서명이 : 이제
HRESULT VariantFromString(PCWSTR wszValue, VARIANT &Variant);
나는 아래와 같이 CString을 전달하고있는 동안 :
char cCurrentPath[FILENAME_MAX];
if (!GetCurrentDir(cCurrentPath, sizeof(cCurrentPath)))
{
return errno;
}
CString strXMLPath = cCurrentPath;
strXMLPath += XMLFILE;
VariantFromString(strXMLPath ,vXMLSource);
오류가 발생합니다. CString에서 PCWSTR로 변환 할 수 없습니다.
나는 내가 아는 CString을 – Simsons
에의 char *에서하지 PCWSTR하는 CString을 변환하려고 :
[편집] 예를 들어, 당신은 당신의 기능을 변경할 수 있습니다. 'CString :: AllocSysString'은'CString'을'PCWSTR'과 호환되는'BSTR'로 변환합니다. – tenfour
또한'BSTR'은'VARIANT'에서 사용되는 것과 똑같습니다. 그래서 실제로 당신의 함수를'HRESULT VariantFromString (const CString & val, VARIANT & variant)'로 바꾸는 것이 가장 좋을 것입니다. – tenfour