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


C++ IOleWindow::Release方法代码示例

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


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

示例1: Stop

void CSysProgressDlg::Stop()
{
    if ((m_isVisible)&&(m_bValid))
    {
        m_pIDlg->StopProgressDialog();
		//Sometimes the progress dialog sticks around after stopping it,
		//until the mouse pointer is moved over it or some other triggers.
		//This process finds the hwnd of the progress dialog and hides it
		//immediately.
		IOleWindow *pOleWindow;
		HRESULT hr=m_pIDlg->QueryInterface(IID_IOleWindow,(LPVOID *)&pOleWindow);
		if(SUCCEEDED(hr))
		{
			HWND hDlgWnd;

			hr=pOleWindow->GetWindow(&hDlgWnd);
			if(SUCCEEDED(hr))
			{
				ShowWindow(hDlgWnd, SW_HIDE);
			}
			pOleWindow->Release();
		}
        m_isVisible = false;
		m_pIDlg->Release();
		m_bValid = false;
    }
}
开发者ID:omnibs,项目名称:TortoiseGit,代码行数:27,代码来源:ProgressDlg.cpp

示例2: OnCreate

void WINAPI duFlash::OnCreate()
{
	IUnknown *pControl = NULL;
	IUnknown *pContainer = NULL;
	HRESULT hr = CreateAxControl(this->GetHwnd(), L"ShockwaveFlash.ShockwaveFlash", &pControl, &pContainer);
	if (FAILED(hr))
		return;
	
	AxAdviseAll(this, pControl);
	
	hr = pControl->QueryInterface(__uuidof(IShockwaveFlash), (void **)&m_pFlash);
	hr = m_pFlash->put_Movie(m_szURL);
	hr = m_pFlash->put_AllowFullScreen(L"true");
	
	IOleWindow *pOleWindow = NULL;
	hr = pControl->QueryInterface(IID_IOleWindow, (void **)&pOleWindow);
				
	HWND hWndObject = NULL;
	pOleWindow->GetWindow(&hWndObject);
	pOleWindow->Release();
	
	Attach(hWndObject);

	m_pContainer = pContainer;
	m_pContainer->AddRef();

	pControl->Release();
	pContainer->Release();
}
开发者ID:blueantst,项目名称:dulib,代码行数:29,代码来源:duFlash.cpp

示例3: ShowModeless

HRESULT CSysProgressDlg::ShowModeless(HWND hWndParent)
{
	EnsureValid();
	HRESULT hr = E_FAIL;

	if (m_bValid)
	{
		hr = m_pIDlg->StartProgressDialog(hWndParent, NULL, m_dwDlgFlags, NULL);

		if (SUCCEEDED(hr))
		{
			m_isVisible = true;

			// The progress window can be remarkably slow to display, particularly
			// if its parent is blocked.
			// This process finds the hwnd for the progress window and gives it a kick...
			IOleWindow *pOleWindow;
			HRESULT hr=m_pIDlg->QueryInterface(IID_IOleWindow,(LPVOID *)&pOleWindow);
			if(SUCCEEDED(hr))
			{
				HWND hDlgWnd;

				hr=pOleWindow->GetWindow(&hDlgWnd);
				if(SUCCEEDED(hr))
				{
					ShowWindow(hDlgWnd, SW_NORMAL);
				}
				pOleWindow->Release();
			}
		}
	}
	return hr;
}
开发者ID:omnibs,项目名称:TortoiseGit,代码行数:33,代码来源:ProgressDlg.cpp

示例4: Show

void ProgressDialog::Show()
{
    DWORD flags = PROGDLG_NORMAL | PROGDLG_NOMINIMIZE;
    HRESULT hr = dialog->StartProgressDialog(GetDesktopWindow(), 0, flags, 0);
    if (!SUCCEEDED(hr))
        return;

    dialog->Timer(PDTIMER_RESET, 0);
    IOleWindow* pIWnd = 0;
    if (dialog->QueryInterface(IID_IOleWindow, (void**)&pIWnd) != S_OK)
        return;

    HWND windowHandle;
    if (pIWnd->GetWindow(&windowHandle) != S_OK)
    {
        pIWnd->Release();
        return;
    }

    // Get the center of the screen.
    this->dialogWindow = windowHandle;
    HDC hScreenDC = CreateCompatibleDC(0);
    int screenWidth = GetDeviceCaps(hScreenDC, HORZRES);
    int screenHeight = GetDeviceCaps(hScreenDC, VERTRES);
    DeleteDC(hScreenDC);

    // Get the dialog size.
    RECT dialogRect;
    GetWindowRect(dialogWindow, &dialogRect);

    // Calculate center position for the dialog and reposition it.
    int centerX = ( screenWidth - (dialogRect.right - dialogRect.left)) / 2;
    int centerY = ( screenHeight - (dialogRect.bottom - dialogRect.top)) / 2;
    SetWindowPos(this->dialogWindow, 0, centerX, centerY-20, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
}
开发者ID:Defachko,项目名称:titanium_desktop,代码行数:35,代码来源:progress_dialog.cpp

示例5: OnFolderChanging

	IFACEMETHODIMP OnFolderChanging(IFileDialog *fd, IShellItem *si) {
		DBGW(L"OnFolderChanging\n");

		if (!once) {
			once = TRUE;
			IOleWindow *ow = NULL;
			if (SUCCEEDED(fd->QueryInterface(&ow))) {
				HWND	hwnd = NULL;
				ow->GetWindow(&hwnd);
				ow->Release();
				wnd->AttachWnd(hwnd, label);
			}
		}
		return E_NOTIMPL;
	}
开发者ID:Mapaler,项目名称:FastCopy-M,代码行数:15,代码来源:tcmndlg.cpp

示例6:

STDMETHODIMP
CDeskBand::SetSite(IUnknown* punkSite)
{
  TRACE_ENTER("CDeskBand::SetSite");
  //If a site is being held, release it.
  if (m_pSite)
    {
      m_pSite->Release();
      m_pSite = NULL;
    }

  //If punkSite is not NULL, a new site is being set.
  if (punkSite)
    {
      //Get the parent window.
      IOleWindow  *pOleWindow;

      m_hwndParent = NULL;

      if (SUCCEEDED(punkSite->QueryInterface(IID_IOleWindow, (LPVOID*)&pOleWindow)))
        {
          pOleWindow->GetWindow(&m_hwndParent);
          pOleWindow->Release();
        }

      if (!m_hwndParent)
        return E_FAIL;

      if (!RegisterAndCreateWindow())
        return E_FAIL;

      //Get and keep the IInputObjectSite pointer.
      if (SUCCEEDED(punkSite->QueryInterface(IID_IInputObjectSite, (LPVOID*)&m_pSite)))
        {
          return S_OK;
        }

      return E_FAIL;
    }

  TRACE_EXIT();
  return S_OK;
}
开发者ID:183amir,项目名称:workrave,代码行数:43,代码来源:DeskBand.cpp

示例7: ShowContextMenu

// IDocHostUIHandler
STDMETHODIMP IEView::ShowContextMenu(DWORD dwID, POINT *ppt, IUnknown *pcmdTarget, IDispatch *pdispReserved) {
	IOleCommandTarget * pOleCommandTarget;
    IOleWindow * pOleWindow;
	HWND hSPWnd;
	if (builder == NULL) {
   //     return S_OK;
	}
    if (SUCCEEDED(pcmdTarget->QueryInterface(IID_IOleCommandTarget, (void**)&pOleCommandTarget))) {
		if (SUCCEEDED(pOleCommandTarget->QueryInterface(IID_IOleWindow, (void**)&pOleWindow))) {
    		pOleWindow->GetWindow(&hSPWnd);
			HMENU hMenu;
			hMenu = GetSubMenu(LoadMenu(hInstance, MAKEINTRESOURCE(IDR_CONTEXTMENU)),0);
		 	CallService(MS_LANGPACK_TRANSLATEMENU,(WPARAM)hMenu,0);
			if (dwID == 5) { // anchor
				EnableMenuItem(hMenu, ID_MENU_COPYLINK, MF_BYCOMMAND | MF_ENABLED);
			} else if (dwID == 4) { // text select
				EnableMenuItem(hMenu, ID_MENU_COPY, MF_BYCOMMAND | MF_ENABLED);
			} else if (dwID == 1) { // control (image)
				EnableMenuItem(hMenu, ID_MENU_SAVEIMAGE, MF_BYCOMMAND | MF_ENABLED);
			}
            if (builder!=NULL) {

			}
		 	int iSelection = TrackPopupMenu(hMenu,
		                                      TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD,
		                                      ppt->x,
		                                      ppt->y,
		                                      0,
		                                      hwnd,
		                                      (RECT*)NULL);
			DestroyMenu(hMenu);
			if (iSelection == ID_MENU_CLEARLOG) {
				clear(NULL);
			} else {
		    	SendMessage(hSPWnd, WM_COMMAND, iSelection, (LPARAM) NULL);
			}
    		pOleWindow->Release();
		}
	    pOleCommandTarget->Release();
	}
	return S_OK;
}
开发者ID:BackupTheBerlios,项目名称:mgoodies-svn,代码行数:43,代码来源:IEView.cpp

示例8: ContextSensitiveHelp

/*
 *	CTxtEdit::ContextSensitiveHelp
 *
 *	@mfunc enter/leave ContextSensitiveHelp mode
 *
 *	@rdesc
 *		HRESULT				Success code.
 */
STDMETHODIMP CTxtEdit::ContextSensitiveHelp( 
	BOOL fEnterMode)			//@parm enter/exit mode
{
	TRACEBEGIN(TRCSUBSYSOLE, TRCSCOPEEXTERN, "CTxtEdit::ContextSensitiveHelp");

	COleObject * pobj = NULL;
	CObjectMgr * pobjmgr = NULL;
	HRESULT hr = NOERROR;
	IOleWindow * pow;
	CCallMgr callmgr(this);

	pobjmgr = GetObjectMgr();

	if( !pobjmgr )
	{
		return E_OUTOFMEMORY;
	}

	// if the mode changes
	if( pobjmgr->GetHelpMode() != fEnterMode )
	{
		pobjmgr->SetHelpMode(fEnterMode);

		pobj = pobjmgr->GetInPlaceActiveObject();

		if (pobj)
		{
			hr = pobj->GetIUnknown()->QueryInterface(IID_IOleWindow,
				(void **)&pow);

			if( hr == NOERROR )
			{
				hr = pow->ContextSensitiveHelp(fEnterMode);
				pow->Release();
			}
		}
	}

	return hr;
}
开发者ID:achellies,项目名称:DUI_LIb,代码行数:48,代码来源:object.cpp

示例9: saveSnapshot


//.........这里部分代码省略.........
        ie = GetAncestor(hwndBrowser, GA_ROOTOWNER);

        CComPtr<IDispatch> spDispatch;
        hr = spBrowser->get_Document(&spDispatch);
        if (FAILED(hr))
            return E_FAIL;

        spDocument = spDispatch;
        if (spDocument == NULL)
            return E_FAIL;


        IServiceProvider* pServiceProvider = NULL;
        if (SUCCEEDED(spBrowser->QueryInterface(
                            IID_IServiceProvider, 
                            (void**)&pServiceProvider)))
        {
            IOleWindow* pWindow = NULL;
            if (SUCCEEDED(pServiceProvider->QueryService(
                            SID_SShellBrowser,
                            IID_IOleWindow,
                            (void**)&pWindow)))
            {

                if (SUCCEEDED(pWindow->GetWindow(&hwndBrowser)))
                {
                    hwndBrowser = FindWindowEx(hwndBrowser, NULL, _T("Shell DocObject View"), NULL);
                    if (hwndBrowser)
                    {
                        hwndBrowser = FindWindowEx(hwndBrowser, NULL, _T("Internet Explorer_Server"), NULL);
                    }
                }

                pWindow->Release();
            }
         
            pServiceProvider->Release();
        } 
    }

    // Nobody else seems to know how to get IViewObject2?!
    // http://starkravingfinkle.org/blog/2004/09/
    spViewObject = spDocument;
    if (spViewObject == NULL)
    {
        Error(L"Unable to convert document to view object.");
        return E_FAIL;
    }

    CComQIPtr<IHTMLDocument5> spDocument5;
    spDocument->QueryInterface(IID_IHTMLDocument5, (void**)&spDocument5);
    if (spDocument5 == NULL)
    {
        Error(L"Snapsie requires IE6 or greater.");
        return E_FAIL;
    }

    CComBSTR compatMode;
    spDocument5->get_compatMode(&compatMode);

    // In non-standards-compliant mode, the BODY element represents the canvas.
    if (compatMode == L"BackCompat")
    {
        CComPtr<IHTMLElement> spBody;
        spDocument->get_body(&spBody);
        if (NULL == spBody)
开发者ID:nirvdrum,项目名称:SnapsIE,代码行数:67,代码来源:CoSnapsie.cpp

示例10: AfxGetStaticModuleState

STDMETHODIMP	ExplorerBar::SetSite( IUnknown *inPunkSite )
{
	AFX_MANAGE_STATE( AfxGetStaticModuleState() );
	
	HRESULT		err;
	
	// Release the old interfaces.
	
	if( mWebBrowser )
	{
		mWebBrowser->Release();
		mWebBrowser = NULL;
	}
	if( mSite )
	{
		mSite->Release();
		mSite = NULL;
	}
	
	// A non-NULL site means we're setting the site. Otherwise, the site is being released (done above).
	
	if( !inPunkSite )
	{
		err = S_OK;
		goto exit;
	}
	
	// Get the parent window.
	
	IOleWindow *		oleWindow;
		
	mParentWindow = NULL;
	err = inPunkSite->QueryInterface( IID_IOleWindow, (LPVOID *) &oleWindow );
	require( SUCCEEDED( err ), exit );
	
	err = oleWindow->GetWindow( &mParentWindow );
	oleWindow->Release();
	require_noerr( err, exit );
	require_action( mParentWindow, exit, err = E_FAIL );
	
	// Get the IInputObject interface.
	
	err = inPunkSite->QueryInterface( IID_IInputObjectSite, (LPVOID *) &mSite );
	require( SUCCEEDED( err ), exit );
	check( mSite );
	
	// Get the IWebBrowser2 interface.
	
	IOleCommandTarget *		oleCommandTarget;
	
	err = inPunkSite->QueryInterface( IID_IOleCommandTarget, (LPVOID *) &oleCommandTarget );
	require( SUCCEEDED( err ), exit );
	
	IServiceProvider *		serviceProvider;
	
	err = oleCommandTarget->QueryInterface( IID_IServiceProvider, (LPVOID *) &serviceProvider );
	oleCommandTarget->Release();
	require( SUCCEEDED( err ), exit );
	
	err = serviceProvider->QueryService( SID_SWebBrowserApp, IID_IWebBrowser2, (LPVOID *) &mWebBrowser );
	serviceProvider->Release();
	require( SUCCEEDED( err ), exit );
	
	// Create the main window.
	
	err = SetupWindow();
	require_noerr( err, exit );
	
exit:
	return( err );
}
开发者ID:longchuan1985,项目名称:android-mdns,代码行数:71,代码来源:ExplorerBar.cpp

示例11: SetSite

HRESULT STDMETHODCALLTYPE CAddressBand::SetSite(IUnknown *pUnkSite)
{
	CComPtr<IShellService>					shellService;
	CComPtr<IUnknown>						offset34;
	HWND									parentWindow;
	IOleWindow								*oleWindow;
	HWND									toolbar;
	static const TBBUTTON					buttonInfo[] = { {0, 1, TBSTATE_ENABLED, 0} };
	HIMAGELIST								normalImagelist;
	HIMAGELIST								hotImageList;
	HINSTANCE								shellInstance;
	HRESULT									hResult;

	fSite.Release();
	if (pUnkSite == NULL)
		return S_OK;
	hResult = pUnkSite->QueryInterface(IID_IDockingWindowSite, (void **)&fSite);
	if (FAILED(hResult))
		return hResult;
	parentWindow = NULL;
	hResult = pUnkSite->QueryInterface(IID_IOleWindow, (void **)&oleWindow);
	if (SUCCEEDED(hResult))
	{
		oleWindow->GetWindow(&parentWindow);
		oleWindow->Release();
	}
	if (!::IsWindow(parentWindow))
		return E_FAIL;

	toolbar = CreateWindowEx(WS_EX_TOOLWINDOW, WC_COMBOBOXEXW, NULL, WS_CHILD | WS_VISIBLE |
					WS_CLIPCHILDREN | WS_TABSTOP | CCS_NODIVIDER | CCS_NOMOVEY,
					0, 0, 500, 250, parentWindow, (HMENU)0xa205, _AtlBaseModule.GetModuleInstance(), 0);
	if (toolbar == NULL)
		return E_FAIL;
	SubclassWindow(toolbar);
	SendMessage(CBEM_SETEXTENDEDSTYLE, CBES_EX_CASESENSITIVE | CBES_EX_NOSIZELIMIT, CBES_EX_CASESENSITIVE | CBES_EX_NOSIZELIMIT);
	fEditControl = (HWND)SendMessage(CBEM_GETEDITCONTROL, 0, 0);
	fComboBox = (HWND)SendMessage(CBEM_GETCOMBOCONTROL, 0, 0);
#if 1
	hResult = CoCreateInstance(CLSID_AddressEditBox, NULL, CLSCTX_INPROC_SERVER, IID_IAddressEditBox, (void **)&fAddressEditBox);
	if (FAILED(hResult))
		return hResult;
#else
	// instantiate new version
#endif
	hResult = fAddressEditBox->QueryInterface(IID_IShellService, (void **)&shellService);
	if (FAILED(hResult))
		return hResult;
	hResult = fAddressEditBox->Init(toolbar, fEditControl, 8, pUnkSite /*(IAddressBand *)this*/ );
	if (FAILED(hResult))
		return hResult;
	hResult = shellService->SetOwner(pUnkSite);
	if (FAILED(hResult))
		return hResult;

	// TODO: properly initialize this from registry
	fGoButtonShown = true;

	shellInstance = GetModuleHandle(_T("shell32.dll"));
	normalImagelist = ImageList_LoadImageW(shellInstance, MAKEINTRESOURCE(IDB_GOBUTTON_NORMAL), 20, 0, RGB(255, 0, 255), IMAGE_BITMAP, LR_CREATEDIBSECTION);
	hotImageList = ImageList_LoadImageW(shellInstance, MAKEINTRESOURCE(IDB_GOBUTTON_HOT), 20, 0, RGB(255, 0, 255), IMAGE_BITMAP, LR_CREATEDIBSECTION);

	fGoButton = CreateWindowEx(WS_EX_TOOLWINDOW, TOOLBARCLASSNAMEW, 0, WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | TBSTYLE_LIST |
						TBSTYLE_FLAT | TBSTYLE_TOOLTIPS | CCS_NODIVIDER | CCS_NOPARENTALIGN | CCS_NORESIZE,
						0, 0, 0, 0, m_hWnd, NULL, _AtlBaseModule.GetModuleInstance(), NULL);
	SendMessage(fGoButton, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0);
	SendMessage(fGoButton, TB_SETMAXTEXTROWS, 1, 0);
	SendMessage(fGoButton, TB_SETIMAGELIST, 0, (LPARAM)normalImagelist);
	SendMessage(fGoButton, TB_SETHOTIMAGELIST, 0, (LPARAM)hotImageList);
	SendMessage(fGoButton, TB_ADDSTRINGW, (WPARAM)_AtlBaseModule.GetResourceInstance(), IDS_GOBUTTONLABEL);
	SendMessage(fGoButton, TB_ADDBUTTONSW, 1, (LPARAM)&buttonInfo);

	return hResult;
}
开发者ID:HBelusca,项目名称:NasuTek-Odyssey,代码行数:74,代码来源:addressband.cpp


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