本文整理汇总了C++中CComBSTR::Copy方法的典型用法代码示例。如果您正苦于以下问题:C++ CComBSTR::Copy方法的具体用法?C++ CComBSTR::Copy怎么用?C++ CComBSTR::Copy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CComBSTR
的用法示例。
在下文中一共展示了CComBSTR::Copy方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Item
/////////////////////////////////////////////////////////////////////
// OPCBrowser::Item method
// Item index is 1-based for VB
STDMETHODIMP COPCBrowserImpl::Item( VARIANT ItemSpecifier, BSTR *pItem)
{
if( ItemSpecifier.vt != VT_I4 && ItemSpecifier.vt != VT_I2 )
return E_INVALIDARG;
if( ItemSpecifier.vt == VT_I2 )
ItemSpecifier.lVal = ItemSpecifier.iVal;
if( ItemSpecifier.lVal < 1 || ItemSpecifier.lVal > m_names.size() )
return E_INVALIDARG;
if( pItem == NULL )
return E_INVALIDARG;
LONG index=1;
m_listPosition = m_names.begin();
while( m_listPosition!=m_names.end() && index < ItemSpecifier.lVal )
{
m_listPosition++;
index++;
}
if( index == ItemSpecifier.lVal )
{
CComBSTR* pName = *m_listPosition;
*pItem = pName->Copy();
return S_OK;
}
return E_FAIL;
}
示例2: get_Name
STDMETHODIMP CConnRecord::get_Name(BSTR* retVal)
{
CComBSTR ret;
wchar_t tmp[256];
ret = m_rec.t_name(tmp, 256);
*retVal = ret.Copy();
return S_OK;
}
示例3: InvokeDialog
STDMETHODIMP CADObjectPicker::InvokeDialog(LONG hWnd)
{
#pragma warning (disable: 4312) // we know what we're doing
UINT i;
DS_SELECTION dsSelection;
m_ADObjectColl->RemoveAll();
// OK, show the dialog
m_adUsers.Init((HWND)hWnd, this);
if (!m_adUsers.ShowUserSelectionDialog())
return S_FALSE;
// decode
DS_SELECTION_LIST* pList = m_adUsers.RetrieveUserSelectionList();
if (NULL == pList)
return S_FALSE;
// walk the list and populate collection
for (i=0; i<pList->cItems; i++)
{
dsSelection = pList->aDsSelection[i];
{
CComPtr<IADObjectInfo> ptrObjInfo;
m_ADObjectColl->Add(&ptrObjInfo);
CComBSTR bstr;
bstr = dsSelection.pwzName;
ptrObjInfo->put_Name(bstr.Copy());
bstr = dsSelection.pwzClass;
ptrObjInfo->put_Class(bstr.Copy());
bstr = dsSelection.pwzADsPath;
ptrObjInfo->put_ADPath(bstr.Copy());
bstr = dsSelection.pwzUPN;
ptrObjInfo->put_UPN(bstr.Copy());
//bstr = dsSelection.pvarFetchedAttributes[0].bstrVal;
//bstr = V_BSTR(&dsSelection.pvarFetchedAttributes[0]);
/*SAFEARRAY * barray = dsSelection.pvarFetchedAttributes[0].parray;
bstr = (bstr)barray[0].cDims;*/
ptrObjInfo->put_ObjectSID(dsSelection.pvarFetchedAttributes[0]);
}
}
return S_OK;
}
示例4: get_LongValue
STDMETHODIMP CConnRecord::get_LongValue(BSTR* retVal)
{
CComBSTR ret;
wchar_t tmp[256];
_i64tow_s(m_rec.longValue, tmp, 256, 10);
ret = tmp;
*retVal = ret.Copy();
return S_OK;
}
示例5: get_Value
STDMETHODIMP CConnRecord::get_Value(BSTR* retVal)
{
CComBSTR ret;
wchar_t tmp[256];
m_rec.value(tmp, 256);
ret = tmp;
*retVal = ret.Copy();
return S_OK;
}
示例6: get_ConId
STDMETHODIMP CConnRecord::get_ConId(BSTR* retVal)
{
wchar_t tmp[256];
_i64tot_s(m_rec.conId, tmp, 256, 10);
CComBSTR ret = tmp;
*retVal = ret.Copy();
return S_OK;
}
示例7: get_Uri
STDMETHODIMP CConnectParams::get_Uri(BSTR* retVal)
{
if (m_param)
{
CComBSTR ret;
ret = m_param->uri();
*retVal = ret.Copy();
}
return S_OK;
}
示例8:
STDMETHODIMP CIE2EMUrlTaker::get_Version(BSTR* pVal)
{
try
{
*pVal = CComBSTR(_T("")).Copy();
TCHAR szAppPath[MAX_PATH] = {0};
HMODULE hMySelf = ::GetModuleHandle(_T("IE2EM.dll"));
::GetModuleFileName(hMySelf,szAppPath,MAX_PATH );
INT nVersionLen = ::GetFileVersionInfoSize(szAppPath,NULL);
if( nVersionLen<= 0 )
{
return S_OK;
}
TCHAR* pBuffer=new TCHAR[nVersionLen];
if(!pBuffer)
{
return S_OK;
}
if(!::GetFileVersionInfo(szAppPath,NULL,nVersionLen,pBuffer))
{
return S_OK;
}
UINT dwBytes;
VS_FIXEDFILEINFO* pFileInf = NULL;
if(::VerQueryValue(pBuffer, _T("\\"),(LPVOID*)&pFileInf,&dwBytes))
{
TCHAR cVersion[MAX_PATH]={0};
_sntprintf(cVersion,MAX_PATH,_T("%d.%d.%d.%d"),HIWORD(pFileInf->dwFileVersionMS),LOWORD(pFileInf->dwFileVersionMS),
HIWORD(pFileInf->dwFileVersionLS),LOWORD(pFileInf->dwFileVersionLS));
CComBSTR str;
str.Append(cVersion,MAX_PATH);
*pVal = str.Copy();
}
delete[] pBuffer;
}
catch (...)
{
*pVal = CComBSTR(_T("exception")).Copy();
}
return S_OK;
}
示例9: XenStoreRead
STDMETHODIMP COxtGuestServices::XenStoreRead(BSTR bstrPath, BSTR *pbstrValue)
{
LPCSTR szValue;
CComBSTR bstrValue;
HRESULT hr;
szValue = (LPCSTR)m_clXs.XS2Read(CW2A(bstrPath), NULL);
if (szValue == NULL)
{
hr = LogCreateFailure((IDS_FAILED_TO_OPEN_XENSTORE___HRESUL_OXTGUESTSERVICES_32),
E_UNEXPECTED);
return hr;
}
bstrValue = szValue;
m_clXs.XS2Free((LPVOID)szValue);
*pbstrValue = bstrValue.Copy();
return S_OK;
}
示例10: DumpComTypes
void DumpComTypes(ITypeLib* pTypeLib)
{
// Dump out the types.
USES_CONVERSION;
pTypeLib->AddRef();
ULONG typeCount = pTypeLib->GetTypeInfoCount();
cout << "\n****** The COM Types ******" << endl;
cout << "There are " << typeCount << " in this type lib" << endl << endl;
for(ULONG typeIndex = 0; typeIndex < typeCount; typeIndex++)
{
ITypeInfo* pInfo = NULL;
TYPEATTR* typeAtt;
CComBSTR temp;
ULONG index = 0;
ULONG numbMembers = 0;
pTypeLib->GetTypeInfo(typeIndex, &pInfo);
pInfo->GetTypeAttr(&typeAtt);
// Based on the kind of COM type, print out some information.
switch(typeAtt->typekind)
{
case TKIND_COCLASS: // type is a coclass.
cout << "(" << typeIndex << ")" << " Coclass with " << typeAtt->cImplTypes << " interface(s). ******" << endl;
temp = typeAtt->guid;
cout << "->CLSID: " << W2A(temp.Copy()) << endl;
pInfo->GetDocumentation(-1, &temp, NULL, NULL, NULL);
cout << "->Name: " << W2A(temp.Copy()) << endl;
break;
case TKIND_DISPATCH: // type is a IDispatch derived interface.
cout << "(" << typeIndex << ")" << " IDispatch based interface with " << typeAtt->cFuncs << " method(s). ******" << endl;
temp = typeAtt->guid;
cout << "->IID: " << W2A(temp.Copy()) << endl;
pInfo->GetDocumentation(-1, &temp, NULL, NULL, NULL);
cout << "->Name: " << W2A(temp.Copy()) << endl;
numbMembers = typeAtt->cFuncs;
for(index = 0; index < numbMembers; index++)
{
FUNCDESC* fx;
pInfo->GetFuncDesc(index, &fx);
pInfo->GetDocumentation(fx->memid, &temp, NULL, NULL, NULL);
cout << " ->" << W2A(temp.Copy()) << " has " << fx->cParams << " params" << endl;
pInfo->ReleaseFuncDesc(fx);
}
break;
case TKIND_INTERFACE: // Type is an IUnknown derived interface.
cout << "(" << typeIndex << ")" << " IUnknown based interface with " << typeAtt->cFuncs << " method(s). ******" << endl;
temp = typeAtt->guid;
cout << "->IID: " << W2A(temp.Copy()) << endl;
pInfo->GetDocumentation(-1, &temp, NULL, NULL, NULL);
cout << "->Name: " << W2A(temp.Copy()) << endl;
numbMembers = typeAtt->cFuncs;
for(index = 0; index < numbMembers; index++)
{
FUNCDESC* fx;
pInfo->GetFuncDesc(index, &fx);
pInfo->GetDocumentation(fx->memid, &temp, NULL, NULL, NULL);
cout << " ->" << W2A(temp.Copy()) << " has " << fx->cParams << " param(s)" << endl;
pInfo->ReleaseFuncDesc(fx);
}
break;
case TKIND_ENUM: // Type is an enum.
cout << "(" << typeIndex << ")" << " Enum with " << typeAtt->cVars << " member(s). ******" << endl;
pInfo->GetDocumentation(-1, &temp, NULL, NULL, NULL);
cout << "->Name: " << W2A(temp.Copy()) << endl;
numbMembers = typeAtt->cVars;
for(index = 0; index < numbMembers; index++)
{
VARDESC* var;
pInfo->GetVarDesc(index, &var);
pInfo->GetDocumentation(var->memid, &temp, NULL, NULL, NULL);
cout << " ->" << W2A(temp.Copy()) << endl;
pInfo->ReleaseVarDesc(var);
}
break;
default:
cout << "Some other type I don't care about..." << endl;
}
cout << endl;
pInfo->ReleaseTypeAttr(typeAtt);
pInfo->Release();
}
pTypeLib->Release();
}