인디노트

C++ BSTR, CString, char 관련 변환 본문

카테고리 없음

C++ BSTR, CString, char 관련 변환

인디개발자 2017. 12. 29. 14:35

BSTR => char *

BSTR bstrVal; <= BSTR

USES_CONVERSION;     // <atlconv.h>, convert를 위한 macro

char *pbstr = OLE2A(bstrVal);     // BSTR -> char *



CString => BSTR *

BSTR *pVal = _bstr_t(m_sign->get_PasswordDlgTitle().AllocSysString()).copy();




BSTR => CString => LPCWSTR

DllExport HRESULT DllPutPasswordDlgTitle(BSTR newVal)

{

CString s(newVal);

m_sign->put_PasswordDlgTitle(s.GetString());

return S_OK;

}



반응형
Comments