当前位置: 首页>>代码示例>>C++>>正文


C++ CComSafeArray::Add方法代码示例

本文整理汇总了C++中CComSafeArray::Add方法的典型用法代码示例。如果您正苦于以下问题:C++ CComSafeArray::Add方法的具体用法?C++ CComSafeArray::Add怎么用?C++ CComSafeArray::Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CComSafeArray的用法示例。


在下文中一共展示了CComSafeArray::Add方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: OnMouseUp

LRESULT IGToolCutterSquare::OnMouseUp (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
	CComSafeArray <int> spSafeArrayPts;
	spSafeArrayPts.Add (m_xPos1);
	spSafeArrayPts.Add (m_yPos1);
	m_xPos1 = GET_X_LPARAM(lParam); 
	m_yPos1 = GET_Y_LPARAM(lParam); 
	m_pFrame->ConvertCoordFrameToPixel ((LONG*)&m_xPos1, (LONG*)&m_yPos1);
	spSafeArrayPts.Add (m_xPos1);
	spSafeArrayPts.Add (m_yPos1);
	CComVariant spVarArray (spSafeArrayPts);
	int nTypeSelection = IGSELECTION_REPLACE;
	if (::GetKeyState (VK_SHIFT) < 0)
		nTypeSelection = IGSELECTION_ADD;
	else if (::GetKeyState (VK_CONTROL) < 0)
		nTypeSelection = IGSELECTION_REMOVE;
	m_pFrame->ManageSelection (IGSELECTION_SQUARE | nTypeSelection, &spVarArray);
	return 0L;
}
开发者ID:Bitlsoft,项目名称:Imagenius_SDK,代码行数:19,代码来源:IGToolCutterSquare.cpp

示例2:

CComSafeArray<BSTR> convertVector2CCOMSafeArray(Result x)
{
\
	CComSafeArray<BSTR> result;

	for (std::string inst : x)
	{
		result.Add(convertstdSTR2BSTR(inst));
	}
	return result;

}
开发者ID:mohitb117,项目名称:TextSearch_Windows,代码行数:12,代码来源:CPPClient_TextFinder.cpp

示例3: explodeDn

STDMETHODIMP CLDAPQuery::explodeDn(
	/* [in] */ BSTR str,
	/* [in] */ ULONG notypes,
	/* [retval][out] */ SAFEARRAY **result)
{
	PTCHAR *vals = ldap_explode_dn(CComBSTR(str), notypes);
	m_errorCode = LdapGetLastError();
	if(vals)
	{
		CComSafeArray<VARIANT> dnValues;
		for(LONG i = 0L; vals[i]!=NULL; i++)
		{
			dnValues.Add(CComVariant(vals[i]));
		}
		ldap_value_free(vals);
		*result = dnValues.Detach();
	}
	return S_OK;
}
开发者ID:Maqentaer,项目名称:LDAPQuery,代码行数:19,代码来源:LDAPQuery.cpp

示例4: GetResults

STDMETHODIMP CTextSearch::GetResults(SAFEARRAY ** files)
{
	// TODO: Add your implementation code here
	Search searchService;
	std::string path = searchService.ConvertBSTRToMBS(_searchPath);
	//std::string keyword = searchService.ConvertBSTRToMBS(_searchKeyword);
	std::vector<std::string> keywords;

	for (int i = 0; i < (int)_searchKeywords.GetCount(); ++i)
		keywords.push_back(searchService.ConvertBSTRToMBS(_searchKeywords[i].Copy()));

	std::vector<std::string> results = searchService.StartTextSearch(keywords, path, _searchAll);
	CComSafeArray<BSTR> temp;
	
	for (auto result : results)
		temp.Add(CComBSTR(result.c_str()));

	*files = temp.Detach();

	return S_OK;
}
开发者ID:yufangong,项目名称:text-finder,代码行数:21,代码来源:TextSearch.cpp

示例5: XlLibraryInitialize

bool XlLibraryInitialize(XlAddInExportInfo* pExportInfo)
{
	HRESULT hr;
	CComPtr<ICorRuntimeHost> pHost;

	hr = LoadClr20(&pHost);
	if (FAILED(hr) || pHost == NULL)
	{
		// LoadClr20 shows diagnostic MessageBoxes if needed.
		// Perhaps remember that we are not loaded?
		return 0;
	}

	// If all is fine now, also start the CLR (always safe to do again.
	hr = pHost->Start();
	if (FAILED(hr))
	{
		ShowMessage(IDS_MSG_HEADER_NEEDCLR20, 
					IDS_MSG_BODY_HOSTSTART,
					IDS_MSG_FOOTER_UNEXPECTED,
					hr);
		return 0;
	}

	CString addInFullPath = AddInFullPath();

	CPath xllDirectory(addInFullPath);
	xllDirectory.RemoveFileSpec();

	CComPtr<IUnknown> pAppDomainSetupUnk;
	hr = pHost->CreateDomainSetup(&pAppDomainSetupUnk);
	if (FAILED(hr) || pAppDomainSetupUnk == NULL)
	{
		ShowMessage(IDS_MSG_HEADER_APPDOMAIN, 
					IDS_MSG_BODY_APPDOMAINSETUP, 
					IDS_MSG_FOOTER_UNEXPECTED,
					hr);
		return 0;
	}

	CComQIPtr<IAppDomainSetup> pAppDomainSetup = pAppDomainSetupUnk;

	hr = pAppDomainSetup->put_ApplicationBase(CComBSTR(xllDirectory));
	if (FAILED(hr))
	{
		ShowMessage(IDS_MSG_HEADER_APPDOMAIN, 
					IDS_MSG_BODY_APPLICATIONBASE, 
					IDS_MSG_FOOTER_UNEXPECTED,
					hr);
		return 0;
	}
	
	CComBSTR configFileName = addInFullPath;
	configFileName.Append(L".config");
	pAppDomainSetup->put_ConfigurationFile(configFileName);

	CComBSTR appDomainName = L"ExcelDna: ";
	appDomainName.Append(addInFullPath);
	pAppDomainSetup->put_ApplicationName(appDomainName);

	IUnknown *pAppDomainUnk = NULL;
	hr = pHost->CreateDomainEx(appDomainName, pAppDomainSetupUnk, 0, &pAppDomainUnk);
	if (FAILED(hr) || pAppDomainUnk == NULL)
	{
		ShowMessage(IDS_MSG_HEADER_APPDOMAIN, 
					IDS_MSG_BODY_APPDOMAIN, 
					IDS_MSG_FOOTER_UNEXPECTED,
					hr);
		return 0;
	}

	CComQIPtr<_AppDomain> pAppDomain(pAppDomainUnk);

	// Load plan for ExcelDna.Loader:
	// Try AppDomain.Load with the name ExcelDna.Loader.
	// Then if it does not work, we will try to load from a known resource in the .xll.

	CComPtr<_Assembly> pExcelDnaLoaderAssembly;
	hr = pAppDomain->Load_2(CComBSTR(L"ExcelDna.Loader"), &pExcelDnaLoaderAssembly);
	if (FAILED(hr) || pExcelDnaLoaderAssembly == NULL)
	{
		HRSRC hResInfoLoader = FindResource(hModuleCurrent, L"EXCELDNA_LOADER", L"ASSEMBLY");
		if (hResInfoLoader == NULL)
		{
			ShowMessage(IDS_MSG_HEADER_APPDOMAIN, 
						IDS_MSG_BODY_MISSINGEXCELDNALOADER, 
						IDS_MSG_FOOTER_UNEXPECTED,
						hr);
			return 0;
		}
		HGLOBAL hLoader = LoadResource(hModuleCurrent, hResInfoLoader);
		void* pLoader = LockResource(hLoader);
		ULONG sizeLoader = (ULONG)SizeofResource(hModuleCurrent, hResInfoLoader);
		
		CComSafeArray<BYTE> bytesLoader;
		bytesLoader.Add(sizeLoader, (byte*)pLoader);

		hr = pAppDomain->Load_3(bytesLoader, &pExcelDnaLoaderAssembly);
		if (FAILED(hr))
		{
//.........这里部分代码省略.........
开发者ID:namin,项目名称:excel4vivi,代码行数:101,代码来源:ExcelDnaLoader.cpp


注:本文中的CComSafeArray::Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。