#include
CString bstrToCString(BSTR bstr)
{
char* pbstr;
USES_CONVERSION; //convert를 위한 매크로
pbstr=OLE2A(bstr); //bstr을 char로 convert
return CString(pbstr);
}
BSTR CStringTobstr(CString str)
{
return str.AllocSysString(); //CString을 bstr로 convert
}
[bstr-> char*]
BSTR inputdata;
char *pbstr;
pbstr=OLE2A(inputdata);
[char* -> bstr]
TCHAR szTitle[ 512 ];
_bstr_t bstrText = szTitle;
*bstrTitle = bstrText.copy();
//CString ==> CComVariant로 변환
CComVariant out(str.AllocSysString()); or CComVariant out(str);
//CComVariant ==> CString
CString szTmp;
szTmp = comvariant.bstrVal;
VARIANT VariantString(BSTR str)
{
VARIANT var;
VariantInit(&var);
V_BSTR(&var) = SysAllocString(str);
V_VT(&var) = VT_BSTR;
return var;
}
CString bstrToCString(BSTR bstr)
{
char* pbstr;
USES_CONVERSION; //convert를 위한 매크로
pbstr=OLE2A(bstr); //bstr을 char로 convert
return CString(pbstr);
}
BSTR CStringTobstr(CString str)
{
return str.AllocSysString(); //CString을 bstr로 convert
}
[bstr-> char*]
BSTR inputdata;
char *pbstr;
pbstr=OLE2A(inputdata);
[char* -> bstr]
TCHAR szTitle[ 512 ];
_bstr_t bstrText = szTitle;
*bstrTitle = bstrText.copy();
//CString ==> CComVariant로 변환
CComVariant out(str.AllocSysString()); or CComVariant out(str);
//CComVariant ==> CString
CString szTmp;
szTmp = comvariant.bstrVal;
VARIANT VariantString(BSTR str)
{
VARIANT var;
VariantInit(&var);
V_BSTR(&var) = SysAllocString(str);
V_VT(&var) = VT_BSTR;
return var;
}
'기본 카테고리' 카테고리의 다른 글
11.메모리,파일입출력,클립보드,스레드 (0) | 2007.07.18 |
---|---|
액티브 X 컴포넌트에 param 태그 쓰기 (0) | 2007.07.12 |
Hosting the Windows Media Player Control in a Windows Application (0) | 2007.07.12 |
atl param (0) | 2007.07.11 |
일본 환타CF (0) | 2007.07.10 |