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


C++ LPDISPATCH类代码示例

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


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

示例1: SetCustomDocUIHandler

HRESULT WebBrowserEventSinker::SetCustomDocUIHandler(LPDISPATCH lpDisp)
{
	if(lpDisp == NULL)
		return E_INVALIDARG;

	IWebBrowser2Ptr pWebBrowser2;
	HRESULT hr = lpDisp->QueryInterface(IID_IWebBrowser2, (void**)&pWebBrowser2);

	if(SUCCEEDED(hr) && pWebBrowser2)
	{
		IDispatchPtr pDoc;
		hr = pWebBrowser2->get_Document(&pDoc);

		if(SUCCEEDED(hr) && pDoc)
		{
			ICustomDocPtr pCustDoc;
			hr = pDoc->QueryInterface(IID_ICustomDoc, (void**)&pCustDoc);
			if(SUCCEEDED(hr) && pCustDoc != NULL)
			{				
				IDocHostUIHandler* pUIHandler;
				CreateObjectInterface<CDocHostUIHandler, IDocHostUIHandler>(NULL, &pUIHandler);

				if (pUIHandler)
					pCustDoc->SetUIHandler(pUIHandler);

				pUIHandler->Release();
			}
		}
	}

	return hr;
}
开发者ID:Johnny-Martin,项目名称:ComBase,代码行数:32,代码来源:WebbrowserEventSinker.cpp

示例2: toggle_button

/* Toggle a button and return the new state.  */
static void
toggle_button (LPDISPATCH button, const char *tag, int instid)
{
  int state;
  char tag2[256];
  char *p;
  LPDISPATCH inspector;
  
  inspector = get_inspector_from_instid (instid);
  if (!inspector)
    {
      log_debug ("%s:%s: inspector not found", SRCNAME, __func__);
      return;
    }

  state = get_oom_int (button, "State");
  log_debug ("%s:%s: button `%s' state is %d", SRCNAME, __func__, tag, state);
  state = (state == msoButtonUp)? msoButtonDown : msoButtonUp;
  put_oom_int (button, "State", state);

  /* Toggle the other button.  */
  mem2str (tag2, tag, sizeof tag2 - 2);
  p = strchr (tag2, '#');
  if (p)
    *p = 0;  /* Strip the instance id suffix.  */
  if (*tag2 && tag2[1] && !strcmp (tag2+strlen(tag2)-2, "@t"))
    tag2[strlen(tag2)-2] = 0; /* Remove the "@t".  */
  else
    strcat (tag2, "@t");      /* Append a "@t".  */
  
  log_debug ("%s:%s: setting `%s' state to %d", SRCNAME, __func__, tag2, state);
  set_one_button (inspector, tag2, state);
  inspector->Release ();
}
开发者ID:gpg,项目名称:gpgol,代码行数:35,代码来源:inspectors.cpp

示例3: get_button

/* Return the button with TAG and assigned to INSPECTOR.  TAG must be
   given without the suffix.  Returns NULL if not found.  */
static LPDISPATCH
get_button (LPDISPATCH inspector, const char *tag)
{
  LPDISPATCH result = NULL;
  inspector_info_t iinfo;
  button_list_t ol;

  lock_all_inspectors ();

  for (iinfo = all_inspectors; iinfo; iinfo = iinfo->next)
    if (iinfo->inspector == inspector)
      {
        for (ol = iinfo->buttons; ol; ol = ol->next)
          if (ol->tag && !strcmp (ol->tag, tag))
            {
              result = ol->button;
              if (result)
                result->AddRef ();
              break;
            }
        break;
      }
  
  unlock_all_inspectors ();
  return result;
}
开发者ID:gpg,项目名称:gpgol,代码行数:28,代码来源:inspectors.cpp

示例4: ExecCommand

//OLECMDID_PRINT	= 6,
HRESULT CWtlHtmlView::ExecCommand( OLECMDID nCmdID, OLECMDEXECOPT nCmdExecOpt, VARIANTARG* pvarargIn, VARIANTARG* pvarargOut) 
{
	HRESULT hr=S_OK;
	LPDISPATCH lpDispatch = NULL;
	LPOLECOMMANDTARGET lpOleCommandTarget = NULL;
	try {

		m_spWebBrowser2->get_Document(&lpDispatch);
		if(lpDispatch==NULL)
			throw;
		OLECMDF eQuery ; //      'return value type for QueryStatusWB

		if(FAILED( m_spWebBrowser2->QueryStatusWB(OLECMDID_PRINT, &eQuery))) //  'get print command status
			throw;

		if(!( eQuery & OLECMDF_ENABLED) )
			throw;

		lpDispatch->QueryInterface(IID_IOleCommandTarget, (void**)&lpOleCommandTarget);
		if(lpOleCommandTarget==NULL)
			throw;

		// Print contents of WebBrowser control.
		hr=lpOleCommandTarget->Exec(NULL, nCmdID, nCmdExecOpt, pvarargIn, pvarargOut);
	}
	catch(...)
	{
		hr=E_FAIL;
	}
	if(lpDispatch)
		lpDispatch->Release();
	if(lpOleCommandTarget)
		lpOleCommandTarget->Release();
	return hr;
}
开发者ID:johnmichaloski,项目名称:CMSD,代码行数:36,代码来源:WTLHtmlView.cpp

示例5: TRACE

void CIncrementSystemBFDlg::DocumentCompleteExplorerSelectItem(LPDISPATCH pDisp, VARIANT* URL)
{
	CString url = URL->bstrVal;

	if (url.Find(cUrls.Logon) > 0){
		TRACE("UnLoadhook");
		unloadhook();
		isLogon = true;
	}
	if (isLogon){
		if (url.Find(cUrls.Http1) > 0){
			TRACE("Loadhook");
			loadhook();
			isLogon = false;
		}
	}
    IUnknown*  pUnk;  
    LPDISPATCH lpWBDisp;  
    HRESULT    hr;  
 
    pUnk = m_MyIE.GetControlUnknown();  
    ASSERT(pUnk);  
 
    hr = pUnk->QueryInterface(IID_IDispatch, (void**)&lpWBDisp);  
    ASSERT(SUCCEEDED(hr));  
 
    if (pDisp == lpWBDisp )  
    {
        //TRACE("Web document is finished downloading/n");//这里就是最佳获取时机的判断
    }
    pUnk->Release();
    lpWBDisp->Release();
}
开发者ID:hucigang,项目名称:IncrementSystemBF,代码行数:33,代码来源:IncrementSystemBFDlg.cpp

示例6: ExecuteScript

VARIANT CWebDlg::ExecuteScript(CString csCode, CString csLanguage)
{
	COleVariant   varRet;

	IHTMLDocument2* pHTMLDocument2;
	IHTMLWindow2*   pHTMLWindow2;
	LPDISPATCH lpDispatch;
	lpDispatch = m_explore.GetDocument();
   
	BSTR            bstrCode    = _bstr_t((const char *)csCode);
	BSTR            bstrLang    = _bstr_t((const char *)csLanguage);
	HRESULT         hr;
 
	if(lpDispatch)
	{
		hr = lpDispatch->QueryInterface(IID_IHTMLDocument2, (void**)&pHTMLDocument2);
		if(hr == S_OK)
		{
			hr = pHTMLDocument2->get_parentWindow(&pHTMLWindow2);
			if(hr == S_OK)
			{
				pHTMLWindow2->execScript(bstrCode, bstrLang, &varRet);
				pHTMLWindow2->Release();
			}
			pHTMLDocument2->Release();
		}
		lpDispatch->Release();
	}
	return varRet;
}
开发者ID:CCChaos,项目名称:RyzomCore,代码行数:30,代码来源:WebDlg.cpp

示例7: addCircleThroughCom

void
addCircleThroughCom()
{
    AutoCAD::IAcadApplication *pAcad;
    AutoCAD::IAcadDocument *pDoc;
    AutoCAD::IAcadModelSpace *pMSpace;

    HRESULT hr = NOERROR;
    LPUNKNOWN pUnk = NULL;
    LPDISPATCH pAcadDisp = acedGetIDispatch(TRUE); 
	if(pAcadDisp==NULL)
		return;
	
	hr = pAcadDisp->QueryInterface(AutoCAD::IID_IAcadApplication,(void**)&pAcad);
	pAcadDisp->Release();
	if (FAILED(hr))
		return;

	hr = pAcad->get_ActiveDocument(&pDoc);
	pAcad->Release();
	if (FAILED(hr))
		return;

	hr = pDoc->get_ModelSpace(&pMSpace);
	pDoc->Release();
	if (FAILED(hr))
		return;


    SAFEARRAYBOUND rgsaBound;
    rgsaBound.lLbound = 0L;
    rgsaBound.cElements = 3;
    long i;
    SAFEARRAY* pStartPoint = NULL;
    pStartPoint = SafeArrayCreate(VT_R8, 1, &rgsaBound);

    i = 0;
    double value = 4.0;
    SafeArrayPutElement(pStartPoint, &i, &value);
    
    i = 1;
    value = 2.0;
    SafeArrayPutElement(pStartPoint, &i, &value);
    
    i = 2;
    value = 0.0;
    SafeArrayPutElement(pStartPoint, &i, &value);
    
    VARIANT pt1;
    pt1.vt = VT_ARRAY | VT_R8;
    pt1.parray = pStartPoint;

    AutoCAD::IAcadCircle *pCircle;
    pMSpace->AddCircle(pt1, 2.0, &pCircle);
	VariantClear(&pt1);
    pMSpace->Release();
}
开发者ID:kevinzhwl,项目名称:ObjectARXMod,代码行数:57,代码来源:AsdkPlainComDocSamp.cpp

示例8: getAcadMenuGroup

bool getAcadMenuGroup(IAcadMenuGroup  **pVal)
{

    IAcadApplication *acadApp = NULL;
    LPDISPATCH  pDisp = NULL;

    if (!getApplication(&pDisp))
        return false;

    HRESULT hr = S_OK;
    hr = pDisp->QueryInterface(IID_IAcadApplication, (LPVOID*)&acadApp);
    if (FAILED(hr))
        return false;


    LPDISPATCH  pTempDisp = NULL;
    IAcadMenuGroups *mnuGrps = NULL;
    long cnt = 0;

    //get the menu groups
    hr = acadApp->get_MenuGroups(&mnuGrps);
    if (FAILED(hr))
    {
        acadApp->Release();
        return false;
    }
    mnuGrps->get_Count(&cnt);


    //get AutoCAD menu group. say it is index 0.
    IAcadMenuGroup *mnuGrp = NULL;

    VARIANT  vtName;
    vtName.vt = VT_I4;
    BSTR  grpName;
    bool found = false ;
    for (long i=0; i < cnt; i++)
    {
        vtName.lVal = i;
        hr = mnuGrps->Item(vtName, &mnuGrp);
        if (FAILED(hr))
            return false;


        hr  = mnuGrp->get_Name(&grpName);
        CString cgrpName(grpName);
        if (cgrpName.CompareNoCase("Acad")==0)
        {
            found = true;
            *pVal = mnuGrp;
            break;
        }
    }

    acadApp->Release();
    return found;
}
开发者ID:kevinzhwl,项目名称:ObjectARXMod,代码行数:57,代码来源:polymnu.cpp

示例9: GetDocument

LPDISPATCH Change::GetDocument()
{
	LPDISPATCH lpDisp = NULL;
	lpDisp = (LPDISPATCH)m_pDoc->GetInterface(&IID_IDispatch);
	
	if (lpDisp)
		lpDisp->AddRef();
	
	return lpDisp;
}
开发者ID:killbug2004,项目名称:WSProf,代码行数:10,代码来源:Change.cpp

示例10: OnActivate

void CNetscapeCntrItem::OnActivate()
{
	char * pSource = NULL;
	const char* ptr;
	LPDISPATCH pdisp;
	HRESULT hr;
	int _convert;
	if (m_lpObject->QueryInterface(IID_IDispatch, (void**)&pdisp) == S_OK){
#ifdef XP_WIN32
		LPCOLESTR lpOleStr = T2COLE("SaveAs");
		hr = pdisp->GetIDsOfNames(IID_NULL, (unsigned short **)&lpOleStr, 1, LOCALE_USER_DEFAULT, &m_idSavedAs);
		pdisp->Release();
		if (hr == S_OK)	
			m_bCanSavedByOLE = TRUE;
		else
			m_idSavedAs = DISPID_UNKNOWN;
#else
			m_idSavedAs = DISPID_UNKNOWN;
#endif
	}

	const char* ptr1 = m_csAddress; 
	if (NET_IsLocalFileURL((char*)ptr1)) {
		XP_ConvertUrlToLocalFile(m_csAddress, &pSource);
		m_csDosName = *pSource;  // pick up the drive name.
		m_csDosName += ":";
		m_csDosName += strchr(pSource, '\\');  // pick up the real file name.
		ptr = m_csDosName;	 
		FE_ConvertSpace((char*)ptr);
		XP_FREE(pSource);
	}

	// the object does not support ole automation, try to find out if this is a storagefile, so
	// we can use OLESave().
	if (!m_bCanSavedByOLE) {
#ifdef XP_WIN32		// we will only want to handle saving when the object had storage file.
		int _convert;
		LPCOLESTR lpsz = A2CW(m_csDosName);
		if (StgIsStorageFile(lpsz) == S_OK) 
			m_bCanSavedByOLE = TRUE;
#else                       
		HRESULT sc1 = StgIsStorageFile(m_csDosName);
		if (GetScode(sc1) == S_OK) 
			m_bCanSavedByOLE = TRUE;
#endif
		}

	CGenericView* pView = GetActiveView();
	CFrameGlue *pFrameGlue = pView->GetFrame();
	if(pFrameGlue != NULL)	{
		m_bLocationBarShowing = pFrameGlue->GetChrome()->GetToolbarVisible(ID_LOCATION_TOOLBAR);
	}

	COleClientItem::OnActivate();
}
开发者ID:vicamo,项目名称:b2g_mozilla-central,代码行数:55,代码来源:cntritem.cpp

示例11: AFX_MANAGE_STATE

// The open document event handle is the place where the real interface work
// is done.
// Vim gets called from here.
//
HRESULT CCommands::XApplicationEvents::DocumentOpen (IDispatch * theDocument)
{
	AFX_MANAGE_STATE (AfxGetStaticModuleState ());

	if (! g_bEnableVim)
		// Vim not enabled or empty command line entered
		return S_OK;

	// First get the current file name and line number

	// Get the document object
	CComQIPtr < ITextDocument, &IID_ITextDocument > pDoc (theDocument);
	if (! pDoc)
		return S_OK;

	BSTR FileName;
	long LineNr = -1;

	// Get the document name
	if (FAILED (pDoc->get_FullName (&FileName)))
		return S_OK;

	LPDISPATCH pDispSel;

	// Get a selection object dispatch pointer
	if (SUCCEEDED (pDoc->get_Selection (&pDispSel)))
	{
		// Get the selection object
		CComQIPtr < ITextSelection, &IID_ITextSelection > pSel (pDispSel);

		if (pSel)
			// Get the selection line number
			pSel->get_CurrentLine (&LineNr);

		pDispSel->Release ();
	}

	// Open the file in Vim and position to the current line
	if (VimOpenFile (FileName, LineNr))
	{
		if (! g_bDevStudioEditor)
		{
			// Close the document in developer studio
			CComVariant vSaveChanges = dsSaveChangesPrompt;
			DsSaveStatus Saved;

			pDoc->Close (vSaveChanges, &Saved);
		}
	}

	// We're done here
	SysFreeString (FileName);
	return S_OK;
}
开发者ID:coliveira,项目名称:vim,代码行数:58,代码来源:Commands.cpp

示例12: MyTimerProc

// MyTimerProc is a callback function passed to SetTimer()
VOID CALLBACK MyTimerProc(HWND /*hwnd*/, UINT /*uMsg*/, UINT /*idEvent*/, 
   DWORD /*dwTime*/)
{
   LPDISPATCH pDisp = NULL;
   // gpMyCtrl is a global variable of type CMyCtrl*
   // _GetEntries() is a static function you get with BEGIN_COM_MAP()
   AtlInternalQueryInterface (gpMyCtrl, CMyCtrl::_GetEntries(), IID_IDispatch, 
      (LPVOID*)&pDisp);
   //...
   pDisp->Release ();
}
开发者ID:terryjintry,项目名称:OLSource1,代码行数:12,代码来源:atlinternalqueryinterface_1.cpp

示例13: GetHtmlDocument

IHTMLDocument2Ptr CH_HBarWnd::GetHtmlDocument(){
  LPDISPATCH pDispatch = 0;
  if(pwb_){
    if (FAILED(pwb_->get_Document(&pDispatch))){
      return NULL;
    }
  }
  IHTMLDocument2Ptr pHtmlDoc2 = pDispatch;
  if(pDispatch)
    pDispatch->Release();
  return pHtmlDoc2;
}
开发者ID:henrywoo,项目名称:ultraie,代码行数:12,代码来源:H_HBarWnd.cpp

示例14: GetAcadApplication

bool ArxToolBar::GetAcadApplication( IAcadApplication*& pAcadApp )
{
    LPDISPATCH  pDisp = NULL;

    if ( !GetAcadApplication( &pDisp ) )
        return false;

    HRESULT hr = S_OK;
    hr = pDisp->QueryInterface( IID_IAcadApplication, ( LPVOID* )&pAcadApp );
    if ( FAILED( hr ) )
        return false;

    return true;
}
开发者ID:kanbang,项目名称:myexercise,代码行数:14,代码来源:ArxToolBar.cpp

示例15:

const COleDispatchDriver&
COleDispatchDriver::operator=(const COleDispatchDriver& dispatchSrc)
{
	if (this != &dispatchSrc)
	{
		LPDISPATCH lpTemp = m_lpDispatch;
		m_lpDispatch = dispatchSrc.m_lpDispatch;
		if (m_lpDispatch != NULL)
			m_lpDispatch->AddRef();
		if (lpTemp != NULL && m_bAutoRelease)
			lpTemp->Release();
		m_bAutoRelease = TRUE;
	}
	return *this;
}
开发者ID:cyb3727,项目名称:annrecognition,代码行数:15,代码来源:OleDispatchDriver.cpp


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