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


C++ OLESTR函数代码示例

本文整理汇总了C++中OLESTR函数的典型用法代码示例。如果您正苦于以下问题:C++ OLESTR函数的具体用法?C++ OLESTR怎么用?C++ OLESTR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: WriteDocument

// 输出日志2,在m_logExplorer写日志
void CLog::DoLog(const CString* output)
{
	if (m_logDocument.p == NULL)
	{
		delete output;
		return;
	}

	WriteDocument(*output);
	delete output;

	// 滚动到底端
	CComPtr<IHTMLElement> body;
	m_logDocument->get_body(&body);
	// 取ID
	static LPOLESTR scrollHeightName = OLESTR("scrollHeight"), scrollTopName = OLESTR("scrollTop");
	static DISPID scrollHeightID = -1, scrollTopID = -1;
	if (scrollHeightID == -1)
		body->GetIDsOfNames(IID_NULL, &scrollHeightName, 1, LOCALE_SYSTEM_DEFAULT, &scrollHeightID);
	if (scrollTopID == -1)
		body->GetIDsOfNames(IID_NULL, &scrollTopName, 1, LOCALE_SYSTEM_DEFAULT, &scrollTopID);
	// body.scrollTop = body.scrollHeight
	DISPPARAMS params = {};
	_variant_t scrollHeight;
#pragma warning(suppress: 6102)
	if (scrollHeightID != -1)
		body->Invoke(scrollHeightID, IID_NULL, LOCALE_SYSTEM_DEFAULT, DISPATCH_PROPERTYGET, &params,
			scrollHeight.GetAddress(), NULL, NULL);
	params.cArgs = 1;
	params.rgvarg = &scrollHeight;
#pragma warning(suppress: 6102)
	if (scrollTopID != -1)
		body->Invoke(scrollTopID, IID_NULL, LOCALE_SYSTEM_DEFAULT, DISPATCH_PROPERTYPUT, &params, NULL, NULL, NULL);
}
开发者ID:dariner,项目名称:TiebaManager,代码行数:35,代码来源:LogHelper.cpp

示例2: OLESTR

STDMETHODIMP ASDTDModel::saveAsText(BSTR *pVal)
{
    if (pVal == NULL) return E_POINTER;

    CComBSTR text = OLESTR("");

    for (int i = 0; i < m_elementDeclarations->m_items.GetSize(); i++)
    {
        CASDTDElement* pElement = (CASDTDElement*)m_elementDeclarations->m_items[i];

        text += pElement->GetAsText();

        if (pElement->m_attributeDecls->m_items.GetSize() > 0)
        {
            text += OLESTR("<!ATTLIST ");
            text += pElement->m_name;
            text += OLESTR(" ");

            for (int j = 0; j < pElement->m_attributeDecls->m_items.GetSize(); j++)
            {
                CASDTDAttribute* pAttribute = (CASDTDAttribute*)pElement->m_attributeDecls->m_items[j];

                text += pAttribute->m_name;
                text += OLESTR("\n");
            }

            text += OLESTR(">\n");
        }
    }

    *pVal = text.Detach();

    return S_OK;
}
开发者ID:sigurdle,项目名称:FirstProject2,代码行数:34,代码来源:ASDTDModel.cpp

示例3: opc_exception

	da_server * local_host::connect_to( const CLSID clsid )
	{		
		ATL::CComPtr<IClassFactory> class_factory_ptr;
		HRESULT result = ::CoGetClassObject(clsid, CLSCTX_LOCAL_SERVER, NULL, IID_IClassFactory, (void**)&class_factory_ptr);
		if (FAILED(result))
		{
			throw opc_exception( result, OLESTR("Failed get Class factory") );
		}

		ATL::CComPtr<IUnknown> unknown_ptr;
		result = class_factory_ptr->CreateInstance(NULL, IID_IUnknown, (void**)&unknown_ptr);
		if (FAILED(result))
		{
			throw opc_exception( result, OLESTR("Failed get create OPC server ref") );
		}

		ATL::CComPtr<IOPCServer> server_ptr;
		result = unknown_ptr->QueryInterface(IID_IOPCServer, (void**)&server_ptr);
		if (FAILED(result))
		{
			throw opc_exception( result, OLESTR("Failed obtain IID_IOPCServer interface from server") );
		}		

		return new opc::da_server( server_ptr );
	}
开发者ID:DragonZX,项目名称:libopc,代码行数:25,代码来源:opc_local_host.cpp

示例4: VariantInit

STDMETHODIMP CGPAXPlugin::Save(LPPROPERTYBAG pPropBag, BOOL fClearDirty, BOOL fSaveAllProperties)
{
	u16 wurl[MAXLEN_URL];
	const char *sptr;
	u16 len;

    VARIANT value;
    if( pPropBag == NULL) return E_INVALIDARG;

    VariantInit(&value);

    V_VT(&value) = VT_BOOL;
    V_BOOL(&value) = m_bAutoStart ? VARIANT_TRUE : VARIANT_FALSE;
    pPropBag->Write(OLESTR("AutoStart"), &value);
    VariantClear(&value);

    V_VT(&value) = VT_BSTR;

	sptr = (const char *)m_url;
	len = gf_utf8_mbstowcs(wurl, MAXLEN_URL, &sptr);
    V_BSTR(&value) = SysAllocStringLen(NULL, len+1);
	memcpy(V_BSTR(&value) , wurl, len*sizeof(u16));
	V_BSTR(&value) [len] = 0;
	
    pPropBag->Write(OLESTR("src"), &value);
    VariantClear(&value);
    return S_OK;
}
开发者ID:bigbensk,项目名称:gpac,代码行数:28,代码来源:GPAXPlugin.cpp

示例5: initialize

	void initialize()
	{
		//HRESULT	result = ::CoInitialize(NULL);
		HRESULT	result = ::CoInitializeEx(NULL, COINIT_MULTITHREADED);
		if (FAILED(result))
		{
			throw opc_exception( result, OLESTR("CoInitialize failed") );
		}

		result = ::CoInitializeSecurity(NULL, -1, NULL, NULL, RPC_C_AUTHN_LEVEL_NONE, RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE, NULL);
		if (FAILED(result))
		{
			throw opc_exception( result, OLESTR("CoInitializeSecurity failed") );
		}

		/*
		if ( memManager )
		{
			result = ::CoGetMalloc(MEMCTX_TASK, memManager);
			if (FAILED(result))
			{
				throw opc_exception( result, OLESTR("CoGetMalloc failed") );
			}
		}
		//*/
	}
开发者ID:DragonZX,项目名称:libopc,代码行数:26,代码来源:opc_client.cpp

示例6: GetXMLNodeText

/**
 * @param strReportName - report file name.
 */
void CExpressModeDlg::GetReportFileName(CString& strReportName)
{
	strReportName.Empty();
	if (! m_pXMLElementDocument)
		return;
	CString strTimeStamp;
	GetXMLNodeText(m_pXMLElementDocument, OLESTR("./timestamp"), strTimeStamp);
	if (! strTimeStamp.IsEmpty())
	{
		ULONGLONG uiTimeStamp = _tcstoui64(strTimeStamp, NULL, 0);
		if (uiTimeStamp != 0)
		{
			CString strApplication;
			GetXMLNodeText(m_pXMLElementDocument, OLESTR("./application"), strApplication);
			if (! strApplication.IsEmpty())
			{
				int nLength = strApplication.GetLength();
				for (int i = 0; i < nLength; ++i)
				{
					TCHAR chValue = strApplication.GetAt(i);
					if (_istalnum(chValue))
						strReportName += chValue;
				}
				strReportName += _T('_');
			}
			SYSTEMTIME DateTime;
			GetDateTime(uiTimeStamp, DateTime);
			CString strTimeStamp;
			strTimeStamp.Format(_T("error_report_%02d%02d%02d-%02d%02d%02d.log"),
				DateTime.wYear % 100, DateTime.wMonth, DateTime.wDay,
				DateTime.wHour, DateTime.wMinute, DateTime.wSecond);
			strReportName += strTimeStamp;
		}
	}
}
开发者ID:Charsi82,项目名称:x-ray1.5.10-2016-,代码行数:38,代码来源:ExpressModeDlg.cpp

示例7: StartPlugin

int StartPlugin(){

    //Create an instance of our VB COM object, and execute
	//one of its methods so that it will load up and show a UI
	//for us, then it uses our other exports to access olly plugin API
	//methods

	CLSID      clsid;
	HRESULT	   hr;
    LPOLESTR   p = OLESTR("IDACompare.CPlugin");

    hr = CoInitialize(NULL);

	 hr = CLSIDFromProgID( p , &clsid);
	 if( hr != S_OK  ){
		 MessageBox(0,"Failed to get Clsid from string\n","",0);
		 return 0;
	 }

	 // create an instance and get IDispatch pointer
	 hr =  CoCreateInstance( clsid,
							 NULL,
							 CLSCTX_INPROC_SERVER,
							 IID_IDispatch  ,
							 (void**) &IDisp
						   );

	 if ( hr != S_OK )
	 {
	   MessageBox(0,"CoCreate failed","",0);
	   return 0;
	 }

	 OLECHAR *sMethodName = OLESTR("DoPluginAction");
	 DISPID  dispid; // long integer containing the dispatch ID

	 // Get the Dispatch ID for the method name
	 hr=IDisp->GetIDsOfNames(IID_NULL,&sMethodName,1,LOCALE_USER_DEFAULT,&dispid);
	 if( FAILED(hr) ){
	    MessageBox(0,"GetIDS failed","",0);
		return 0;
	 }

	 DISPPARAMS dispparams;
	 VARIANTARG vararg[1]; //function takes one argument
	 VARIANT    retVal;

	 VariantInit(&vararg[0]);
	 dispparams.rgvarg = &vararg[0];
	 dispparams.cArgs = 0;  // num of args function takes
	 dispparams.cNamedArgs = 0;

	 // and invoke the method
	 hr=IDisp->Invoke( dispid, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &dispparams, &retVal, NULL, NULL);

	 return 0;
}
开发者ID:jkennelly,项目名称:IDACompare,代码行数:57,代码来源:idacompare.cpp

示例8: GetInfo

STDMETHODIMP CLiveColors::GetInfo(BSTR* psDescription, BSTR* psAuthor, BSTR* psEmail, BSTR* psHomepage)
{
    if (psDescription)  *psDescription  = OLE2BSTR(OLESTR("Show color values for HEX or RGB defined colors inline in source code"));
    if (psAuthor)       *psAuthor       = OLE2BSTR(OLESTR("HippoEDIT"));
    if (psEmail)        *psEmail        = OLE2BSTR(OLESTR("[email protected]"));
    if (psHomepage)     *psHomepage     = OLE2BSTR(OLESTR("http://wiki.hippoedit.com/plugins/live-colors"));

    return S_OK;
}
开发者ID:hippoedit,项目名称:live-colors,代码行数:9,代码来源:PlugIn.cpp

示例9: Length

void P2PFrame::handleEvent(Event* evt)
{
	sysstring type = evt->get_type();

	EventPhaseType phase = evt->get_eventPhase();
	if (phase != CAPTURING_PHASE)
	{
		if (type == OLESTR("click"))
		{
			evt->stopPropagation();

			Results* pResults = new Results;

			sysstring searchString = m_searchEdit->GetText();

			// TODO, search on all networks

			for (int i = 0; i < m_Networks->m_itemContainer->GetCount(); i++)
			{
				Network* pNetwork = dynamic_cast<Network*>(m_Networks->m_itemContainer->GetItem(i));

				pResults->m_query = pNetwork->pP2P->Search(searchString, static_cast<ISearchHitHandler*>(pResults));
			//	m_GnutellaNetwork->pP2P->Search(searchString, static_cast<ISearchHitHandler*>(pResults));
			}

		//	TreeControlContainer* container = new TreeControlContainer;
		//	pResults->m_itemContainer = container;

			ChildWindow* pWindow = new ChildWindow;
			pWindow->put_Width(new Length(300, Length::UnitAbsolute));
			pWindow->put_Height(new Length(300, Length::UnitAbsolute));

			pWindow->put_Content(pResults);
			pWindow->put_TitleText(searchString);
			pCanvas->AddChild(pWindow);
		}
		else if (type == OLESTR("keydown"))
		{

#if 0
			printf("Step Into\n");
			OnDebugStepInto();
			return;
#endif
		}
		else if (type == OLESTR("mousedown"))
		{
		//	OnDebugStepInto();
		}
	}

	CLXUIWindow::handleEvent(evt);
}
开发者ID:sigurdle,项目名称:FirstProject2,代码行数:53,代码来源:P2PFrame.cpp

示例10: DlgProc

BOOL CALLBACK DlgProc(HWND hwnd,UINT Msg,WPARAM wParam,LPARAM lParam)
{
	IWebBrowser2* iWebBrowser;
	VARIANT varMyURL;
	CAxWindow WinContainer;
	LPOLESTR pszName = OLESTR("shell.Explorer.2");
	RECT rc;
	BOOL result = FALSE;


	switch(Msg)
	{
	case WM_INITDIALOG:
		browserEventListener.setUnloaded();
		GetClientRect(hwnd, &rc);
		WinContainer.Create(hwnd, rc, 0,WS_CHILD |WS_VISIBLE);
		WinContainer.CreateControl(pszName);
		WinContainer.QueryControl(__uuidof(IWebBrowser2),(void**)&iWebBrowser); 
		VariantInit(&varMyURL);
		varMyURL.vt = VT_BSTR; 
		varMyURL.bstrVal = SysAllocString(OLESTR("about:blank"));
		browserEventListener.Advise(hwnd, iWebBrowser);
		iWebBrowser-> Navigate2(&varMyURL,0,0,0,0);

		VariantClear(&varMyURL);
		iWebBrowser-> Release(); 
		result = TRUE;
		break;
	case WM_HTML_ACTION:
		switch (wParam)
		{
		case ACTION_COMMIT:
			EndDialog(hwnd, ACTION_COMMIT);
			result = TRUE;
			break;
		case ACTION_RETURN:
			EndDialog(hwnd, ACTION_RETURN);
			result = TRUE;
			break;
		}
		break;
	case WM_COMMAND:
		switch(wParam)
		{
		case IDCANCEL:
			EndDialog(hwnd, ACTION_RETURN);
			result = TRUE;
		}
		break;
	}

	return result;
}
开发者ID:hellomotor,项目名称:hisinfopost,代码行数:53,代码来源:hisinfopost.cpp

示例11: GetPropValue

// CMSOmniProvRowset :: CreateColInfo 
// This function creates all of the column information and stores it in the rowset.
// It currently uses all of the columns of the table
void CMSOmniProvRowset::CreateColInfo()
{
	// check if bookmarks are set 
	bool bUseBookmarks = false;
	CComVariant varBookmarks;
	HRESULT hrLocal = GetPropValue(&DBPROPSET_ROWSET, DBPROP_BOOKMARKS, &varBookmarks);
	bUseBookmarks = (hrLocal == S_OK &&  varBookmarks.boolVal == VARIANT_TRUE);

	// get column info from the .INI file
	DBORDINAL ulNumCols;
	ATLCOLUMNINFO * prgColInfo = m_DBFile.GetSchemaInfo(&ulNumCols);
	
	// Need to add bookmark column info?
	if (bUseBookmarks)
	{
		// create new set of column information which includes bookmarks
		ATLCOLUMNINFO * prgColInfoNew;
		prgColInfoNew = new ATLCOLUMNINFO[ulNumCols+1];

		// set bindings for the bookmark
		memset(&prgColInfoNew[0], 0, sizeof(ATLCOLUMNINFO));
		prgColInfoNew[0].cbOffset = 0;
		prgColInfoNew[0].iOrdinal = 0;
		prgColInfoNew[0].columnid.eKind = DBKIND_NAME;
		prgColInfoNew[0].columnid.uGuid.guid = GUID_NULL;
		prgColInfoNew[0].columnid.uName.pwszName = OLESTR("Bookmark");
		prgColInfoNew[0].pwszName = OLESTR("Bookmark");
		prgColInfoNew[0].wType = DBTYPE_I4;
		prgColInfoNew[0].ulColumnSize = 4;
		prgColInfoNew[0].dwFlags = DBCOLUMNFLAGS_ISBOOKMARK;
		
		// copy the old information into the new
		for (DBORDINAL i = 1; i <= ulNumCols; i++)
		{
			prgColInfoNew[i] = prgColInfo[i-1];  
			prgColInfoNew[i].cbOffset +=4;  //adjust space for bookmark
		}

		ulNumCols++;
		prgColInfo = prgColInfoNew;
	}

	// store column info in the rowset object
	SetSchemaInfo(prgColInfo, ulNumCols);
	// 2.0
	// Release the temporary prgColInfo
	delete [] prgColInfo;
}
开发者ID:AbdoSalem95,项目名称:WindowsSDK7-Samples,代码行数:51,代码来源:msomniprovrs.cpp

示例12: main

void main(void)
{
    HRESULT hr = CoInitializeEx(0, COINIT_MULTITHREADED);

    if (SUCCEEDED(hr))
    {
        {
            SI(IUnknown) siUnk;
            hr = siUnk.Instantiate(CLSID_Goodbye);
            if (SUCCEEDED(hr))
            {
                SI(IHello) siHello = siUnk;
                siHello->HelloWorld();
            }
            SI(IPersistStorage) sips;
            hr = sips.BindToObject(_U("D:\\dbox\\courseware\\ecom\\02_cxx.ppt"));



            SI(IClassFactory) sicf;
            hr = sicf.GetClassObject(OLESTR("Excel.Sheet"));

            SI(IUnknown) p1;

            hr = sicf->CreateInstance(0, IID_PPV(p1));
            hr = OleRun(p1.GetNonAddRefedInterface());


        }
        CoUninitialize();
    }
}
开发者ID:alannet,项目名称:example,代码行数:32,代码来源:client.cpp

示例13: RETURN_FAILED

HRESULT CPigEngine::get_AccountDispenser(IPigAccountDispenser** ppDispenser)
{
  // Get the computer name of the account server
  CComBSTR bstrServer;
  RETURN_FAILED(get_AccountServer(&bstrServer));
  if (!bstrServer.Length())
  {
    // Get the computer name of the mission server
    RETURN_FAILED(get_MissionServer(&bstrServer));
  }

  // Check for '.' to indicate this computer
  if (1 == bstrServer.Length() && OLESTR('.') == bstrServer[0])
    bstrServer.Empty();

  // Create the Pig Account Dispenser on the mission server
  COSERVERINFO si  = {0, bstrServer, NULL, 0};
  MULTI_QI     mqi = {&IID_IPigAccountDispenser, NULL, S_OK};
  RETURN_FAILED(CoCreateInstanceEx(CLSID_PigAccountDispenser, NULL,
    CLSCTX_SERVER, &si, 1, &mqi));

  // Copy the interface pointer to the [out] parameter
  ZSucceeded(mqi.hr);
  *ppDispenser = (IPigAccountDispenser*)mqi.pItf;

  // Indicate success
  return S_OK;
}
开发者ID:borgified,项目名称:Allegiance,代码行数:28,代码来源:PigEngine.cpp

示例14: memset

// I need to make sure the file is registered with long filenames
HRESULT WINAPI CXMLDOMDocument::UpdateRegistry(BOOL bRegister)
{
	USES_CONVERSION;

	TCHAR file[MAX_PATH];
	if (::GetModuleFileName(_Module.m_hInst, file, MAX_PATH)) {
		WIN32_FIND_DATA d;
		memset(&d,0,sizeof(WIN32_FIND_DATA));
		HANDLE h = FindFirstFile(file,&d);
		if (h != INVALID_HANDLE_VALUE) {
			TCHAR  *name = _tcsrchr(file,_T('\\'));
			TCHAR newFile[MAX_PATH] = _T("");
			_tcsncpy(newFile,file,name-file);
			_tcscat(newFile,_T("\\"));
			_tcscat(newFile,d.cFileName);
			FindClose(h);
			
			_ATL_REGMAP_ENTRY regmap[2] = {{NULL,NULL},{NULL,NULL}};
			regmap[0].szKey  = OLESTR("XMLMODULE");
			regmap[0].szData = T2OLE(newFile);
			return _Module.UpdateRegistryFromResource((UINT) IDR_XMLDOCUMENT, bRegister,regmap);
		}
	}
	return E_FAIL;
}
开发者ID:gitrider,项目名称:wxsj2,代码行数:26,代码来源:XMLDOMDocument.cpp

示例15: raw_Terminate

STDMETHODIMP CPluginImpl::raw_Terminate()
{
    try {
        if ( NULL != customDirController_ ) {
            GrymCore::IStdDirectoryCustomControllerContainerPtr controllerContainer =
                g_pi.baseView->Frame->DirectoryCollection->GetDirectory(OLESTR("Grym.DirPage.Org"));
            controllerContainer->UnregisterController(customDirController_);
        }

        if ( NULL != searchGroup_ && NULL != ctrlSearch_ )
            GrymCore::IControlSetPtr(searchGroup_)->RemoveControl(ctrlSearch_);

        if ( NULL != toolsGroup_ && NULL != cmdExport_ )
            GrymCore::IControlSetPtr(searchGroup_)->RemoveControl(cmdExport_);


        ctrlSearch_ = NULL;
        cmdExport_ = NULL;
        searchGroup_ = NULL;
        toolsGroup_ = NULL;
        customDirController_ = NULL;
        g_pi.baseView = NULL;
        g_pi.grymApp = NULL;
    } catch(...) {
    }

    return S_OK;
}
开发者ID:jimdi,项目名称:2gis-export-plugin,代码行数:28,代码来源:PluginImpl.cpp


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