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


C++ LPUNKNOWN类代码示例

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


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

示例1: CDialog

CDlgIADsPropertyList::CDlgIADsPropertyList(LPUNKNOWN pUnk, CWnd* pParent /*=NULL*/)
    : CDialog(CDlgIADsPropertyList::IDD, pParent)
{
    //{{AFX_DATA_INIT(CDlgIADsPropertyList)
    m_sAttribute = _T("");
    //}}AFX_DATA_INIT

    HRESULT hr;
    m_pPropList = NULL;
    hr = pUnk->QueryInterface( IID_IADsPropertyList, (void **) &m_pPropList );
    if ( !SUCCEEDED(hr) )
    {
        AfxMessageBox(_T("Fatal Error! QI for IADsPropertyList failed"));
        return;
    }
    pUnk->Release();


    //////////////////////////////////////////
    // Retrieve the data to the cache
    ////////////////////////////////////////////
    IADs *pADs=NULL;
    hr = m_pPropList->QueryInterface( IID_IADs, (void**) &pADs );
    if ( SUCCEEDED(hr) )
    {
        hr = pADs->GetInfo();
        pADs->Release();
    }



}
开发者ID:dgrapp1,项目名称:WindowsSDK7-Samples,代码行数:32,代码来源:ADsPropertyList.cpp

示例2: CDialog

CDlgIDirectoryObject::CDlgIDirectoryObject(LPUNKNOWN pUnk, CWnd* pParent /*=NULL*/)
	: CDialog(CDlgIDirectoryObject::IDD, pParent)
{
	//{{AFX_DATA_INIT(CDlgIDirectoryObject)
	m_sDN = _T("");
	m_sRDN = _T("");
	m_sSchema = _T("");
	m_sClass = _T("");
	m_sParent = _T("");
	m_sAttributes = _T("");
	//}}AFX_DATA_INIT

	HRESULT hr;
	m_pDirObject = NULL;
	hr = pUnk->QueryInterface( IID_IDirectoryObject, (void **) &m_pDirObject );
	if ( !SUCCEEDED(hr) )
	{
		AfxMessageBox(_T("Fatal Error! QI for IDirectoryObject failed"));
		return;
	}
	pUnk->Release();

	ShowAttributes();

}
开发者ID:AbdoSalem95,项目名称:WindowsSDK7-Samples,代码行数:25,代码来源:DirectoryObject.cpp

示例3: CDialog

CDlgIADs::CDlgIADs(LPUNKNOWN pUnk, CWnd* pParent /*=NULL*/)
	: CDialog(CDlgIADs::IDD, pParent)
{
	//{{AFX_DATA_INIT(CDlgIADs)
	m_sADsPath = _T("");
	m_sClass = _T("");
	m_sName = _T("");
	m_sParent = _T("");
	m_sSchema = _T("");
	m_sGUID = _T("");
	//}}AFX_DATA_INIT

	///////////////////////////////////////
	// Get the IADs pointer and save it 
	/////////////////////////////////////
	HRESULT hr;
	m_pADs = NULL;
	hr = pUnk->QueryInterface( IID_IADs, (void **) &m_pADs );
	if ( !SUCCEEDED(hr) )
	{
		AfxMessageBox(_T("Fatal Error! QI for IADs failed"));
		return;
	}
	pUnk->Release();
	

}
开发者ID:Essjay1,项目名称:Windows-classic-samples,代码行数:27,代码来源:ADs.cpp

示例4: CDialog

CDlgIDirectorySearch::CDlgIDirectorySearch(LPUNKNOWN pUnk, CWnd* pParent /*=NULL*/)
	: CDialog(CDlgIDirectorySearch::IDD, pParent)
{
	//{{AFX_DATA_INIT(CDlgIDirectorySearch)
	m_sFilter = _T("");
	m_bEnableFilter = FALSE;
	m_nTimeOut = 0;
	m_bCacheResult = FALSE;
	m_nPageSize = 0;
	m_sSortOn = _T("");
	m_nTimeLimit = 0;
	m_nSizeLimit = 0;
	m_bAsynch = FALSE;
	m_bAttrib = FALSE;
	m_nDeref = -1;
	//}}AFX_DATA_INIT
	HRESULT hr;
	m_pSearch = NULL;
	hr = pUnk->QueryInterface( IID_IDirectorySearch, (void **) &m_pSearch );
	if ( !SUCCEEDED(hr) )
	{
		AfxMessageBox(_T("Fatal Error! QI for IDirectorySearch failed"));
		return;
	}
	pUnk->Release();



}
开发者ID:Essjay1,项目名称:Windows-classic-samples,代码行数:29,代码来源:DirectorySearch.cpp

示例5: AfxEnableControlContainer

int CTemplateWizardDialog::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (TEMPLATE_WIZARD_DIALOG::OnCreate(lpCreateStruct) == -1)
		return -1;
	
	AfxEnableControlContainer();

	// create the control window
	// AFX_IDW_PANE_FIRST is a safe but arbitrary ID
	if (!m_wndBrowser.CreateControl(CLSID_WebBrowser, "",
				WS_VISIBLE | WS_CHILD, CRect(0, 0, 0, 0), this, AFX_IDW_PANE_FIRST))
	{
		DestroyWindow();
		return FALSE;
	}

	LPUNKNOWN lpUnk = m_wndBrowser.GetControlUnknown();
	HRESULT hr = lpUnk->QueryInterface(IID_IWebBrowser2, (void**) &m_pBrowserApp);
	if (!SUCCEEDED(hr))
	{
		m_pBrowserApp = NULL;
		m_wndBrowser.DestroyWindow();
		DestroyWindow();
		return FALSE;
	}

	return 0;
}
开发者ID:Luomu,项目名称:workspacewhiz,代码行数:28,代码来源:TemplateWizardDialog.cpp

示例6: FARINTERNAL_

FARINTERNAL_(BOOL) UtGetClassID(LPUNKNOWN lpUnk, CLSID FAR* lpClsid)
{
	VDATEHEAP();

	LPOLEOBJECT lpOleObj; // IOleObject pointer
	LPPERSIST lpPersist; // IPersist pointer

	// try to ask it as an object
	if (lpUnk->QueryInterface(IID_IOleObject,
			(LPLPVOID)&lpOleObj) == NOERROR)
	{
		lpOleObj->GetUserClassID(lpClsid);
		lpOleObj->Release();
		return(TRUE);
	}       
	
	// try to ask it as a persistent object
	if (lpUnk->QueryInterface(IID_IPersist,
			(LPLPVOID)&lpPersist) == NOERROR)
	{
		lpPersist->GetClassID(lpClsid);
		lpPersist->Release();
		return(TRUE);
	}
	
	*lpClsid = CLSID_NULL;
	return(FALSE);
}
开发者ID:mingpen,项目名称:OpenNT,代码行数:28,代码来源:ole2util.cpp

示例7: EnumerateInterface

void CADQIDlg::EnumerateInterface()
{
    int xx=0;
    HRESULT hr;
    LPUNKNOWN pQI;

    m_cListIf.ResetContent();

    ///////////////////////////////////////////////////////////////
    // Query Interface all known ADSI Interfaces
    ////////////////////////////////////////////////////////////////
    while( !IsEqualIID( *adsiIfs[xx].pIID, IID_NULL ) )
    {
        hr = m_pUnk->QueryInterface( *adsiIfs[xx].pIID, (void**) &pQI );
        if ( SUCCEEDED(hr) )
        {
            m_cListIf.AddString( adsiIfs[xx].szIf );
            pQI->Release();
        }
        xx++;
    }



}
开发者ID:dbremner,项目名称:Windows-classic-samples,代码行数:25,代码来源:ADQIDlg.cpp

示例8: MAKEWPARAM

STDMETHODIMP CIEControlSite::XDocHostUIHandler::ShowContextMenu(
    DWORD dwID, LPPOINT ppt, LPUNKNOWN pcmdTarget, LPDISPATCH pdispReserved)
{
    METHOD_PROLOGUE_EX_(CIEControlSite, DocHostUIHandler);
    return S_FALSE;

    // 点击右键添加到收藏夹
    HWND hwnd;
    CComPtr<IOleCommandTarget> spCT;
    CComPtr<IOleWindow> spWnd;

    HRESULT hr = pcmdTarget->QueryInterface(IID_IOleCommandTarget, (void**)&spCT);
    if ( FAILED(hr) )
        return S_FALSE;

    hr = pcmdTarget->QueryInterface(IID_IOleWindow, (void**)&spWnd);
    if ( FAILED(hr) )
        return S_FALSE;

    hr = spWnd->GetWindow(&hwnd);

#define ID_IE_ID_ADDFAV 2261
    ::SendMessage(hwnd, WM_COMMAND, MAKEWPARAM(LOWORD(ID_IE_ID_ADDFAV), 0x0), 0 );

    return S_OK;
}
开发者ID:jiaofeng,项目名称:Fire-IE,代码行数:26,代码来源:IEControlSite.cpp

示例9: GetItemInfo

STDMETHODIMP ActiveScriptImpl::GetItemInfo(
			/* [in] */ LPCOLESTR pstrName,
			/* [in] */ DWORD dwReturnMask,
			/* [out] */LPUNKNOWN* ppiunkItem,
			/* [out] */LPTYPEINFO* ppti)
{
	if (dwReturnMask & SCRIPTINFO_ITYPEINFO)
	{
		if (!ppti)
			return E_INVALIDARG;
		*ppti = NULL;
	}

	if (dwReturnMask & SCRIPTINFO_IUNKNOWN)
	{
		if (!ppiunkItem)
			return E_INVALIDARG;
		*ppiunkItem = NULL;
	}

	LPUNKNOWN lpUnknown = namedItems.get(pstrName);
	if (NULL == lpUnknown)
	{
		ATLTRACE("No IUnknown for item!\n");
		// This shouldn't ever happen, since we're providing the items
		return TYPE_E_ELEMENTNOTFOUND;
	}

	if (dwReturnMask & SCRIPTINFO_ITYPEINFO)
	{
		// Use IProvideClassInfo to get ITypeInfo of coclass!
		IProvideClassInfo *pci = NULL;
		HRESULT hr = lpUnknown->QueryInterface(IID_IProvideClassInfo, (void**)&pci);
		if (SUCCEEDED(hr) && pci)
		{
			hr = pci->GetClassInfo(ppti);
		}

		// Release interface
		if (pci)
			pci->Release();

		if (FAILED(hr))
			return E_FAIL;
	}

	if (dwReturnMask & SCRIPTINFO_IUNKNOWN)
	{
		*ppiunkItem = lpUnknown;
		int *pInt = weakItems.get(pstrName);
		if (!pInt)
			(*ppiunkItem)->AddRef();    // because returning
		else
			*pInt = (*pInt) + 1;
	}

	return S_OK;
}
开发者ID:Templier,项目名称:desktopx,代码行数:58,代码来源:ActiveScriptImpl.cpp

示例10: UpdateData

BOOL CSignalDefinerDlg::OnInitDialog()
{
    CDialog::OnInitDialog();


    UpdateData(FALSE);
    m_ctrNoOfCycles.SetCurSel(m_nSelCycle);

    //Get the CWnd reference to the DMGraph ActiveX control
    m_poDMGraphCtrl = GetDlgItem(IDC_DMGRAPHCTRL);

    /*Set Graph properties*/
    if( m_poDMGraphCtrl->m_hWnd != NULL )
    {
        LPUNKNOWN pUnk = m_poDMGraphCtrl->GetControlUnknown();
        IDMGraphCtrl* pDMGraphCtrl = NULL;

        pUnk->QueryInterface(IID_IDMGraphCtrl, (void**) &pDMGraphCtrl);
        if (  pDMGraphCtrl ==NULL )
        {
            return TRUE;
        }
        // Set Axis Color
        pDMGraphCtrl->put_AxisColor((OLE_COLOR)0xFF);
        // Set Plot Area Color
        pDMGraphCtrl->put_PlotAreaColor((OLE_COLOR)0x00);
        // Set Grid Color
        pDMGraphCtrl->put_GridColor((OLE_COLOR)0xC0C0C0);
        // Set Frame Style
        pDMGraphCtrl->put_FrameStyle((FrameStyle)1);
        // Set Frame Color
        pDMGraphCtrl->put_ControlFrameColor((OLE_COLOR)0x5500);

        // Set Grid Lines Count
        CComPtr<IDMGraphAxis> spAxisX;
        pDMGraphCtrl->get_Axis( HorizontalX, &spAxisX);
        spAxisX->put_GridNumber(10);

        CComPtr<IDMGraphAxis> spAxisY;
        pDMGraphCtrl->get_Axis( VerticalY, &spAxisY);
        spAxisY->put_GridNumber(5);

        if (NULL != pDMGraphCtrl)
        {
            pDMGraphCtrl->Release();
            pDMGraphCtrl = NULL;
        }
    }

    vGenerateWave();


    return TRUE;  // return TRUE unless you set the focus to a control
    // EXCEPTION: OCX Property Pages should return FALSE
}
开发者ID:answer000000,项目名称:busmaster,代码行数:55,代码来源:SignalDefinerDlg.cpp

示例11: AfxDllGetClassObject

SCODE AFXAPI AfxDllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
{
    SCODE sc;
    *ppv = NULL;

    AFX_OLE_STATE* pOleState = AfxGetOleState();
    // search factories defined in the application
    for (COleObjectFactory* pFactory = pOleState->m_pFirstFactory;
            pFactory != NULL; pFactory = pFactory->m_pNextFactory)
    {
        if (pFactory->m_dwRegister != 0 && pFactory->m_clsid == rclsid)
        {
            // found suitable class factory -- query for correct interface
            sc = pFactory->ExternalQueryInterface(&riid, ppv);
            if (sc != NOERROR)
                return sc;
#ifndef _UNICODE
            LPUNKNOWN lpUnk = (LPUNKNOWN)*ppv;
            ASSERT(lpUnk != NULL);
            sc = ::Ole2AnsiWFromA(riid, lpUnk, (LPUNKNOWN*)ppv);
            lpUnk->Release();
#endif
            return sc;
        }
    }
#ifdef _AFXDLL
    // search factories defined in extension DLLs
    AFX_CORE_STATE* pCoreState = AfxGetCoreState();
    for (CDynLinkLibrary* pDLL = pCoreState->m_pFirstDLL; pDLL != NULL;
            pDLL = pDLL->m_pNextDLL)
    {
        for (pFactory = pDLL->m_pFirstSharedFactory;
                pFactory != NULL; pFactory = pFactory->m_pNextFactory)
        {
            if (pFactory->m_dwRegister != 0 && pFactory->m_clsid == rclsid)
            {
                // found suitable class factory -- query for correct interface
                sc = pFactory->ExternalQueryInterface(&riid, ppv);
                if (sc != NOERROR)
                    return sc;
#ifndef _UNICODE
                LPUNKNOWN lpUnk = (LPUNKNOWN)*ppv;
                ASSERT(lpUnk != NULL);
                sc = ::Ole2AnsiWFromA(riid, lpUnk, (LPUNKNOWN*)ppv);
                lpUnk->Release();
#endif
                return sc;
            }
        }
    }
#endif

    // factory not registered -- return error
    return CLASS_E_CLASSNOTAVAILABLE;
}
开发者ID:shuowen,项目名称:OpenNT,代码行数:55,代码来源:oledll.cpp

示例12: MADX9_FreePointer

DLLEXPORT double MADX9_FreePointer(double p)
{
	LPUNKNOWN ptr = (LPUNKNOWN) DoubleToPtr(p);

	if (ptr == 0)
		return ErrorHandle(mamain->err, ErrorInv);

	ptr->Release();

	return ErrorOk;
}
开发者ID:gitter-badger,项目名称:MA-Engine,代码行数:11,代码来源:MA_Misc.cpp

示例13: AfxEnableControlContainer

BOOL CHTMLContainerDlg::OnInitDialog()
{
	AfxEnableControlContainer();

	CDialog::OnInitDialog();

	RECT rectClient;
	GetClientRect(&rectClient);

	// if we've been created from the dynamic template
	// set the caption
	if(!m_lpszTemplateName)
		SetWindowText(m_strDlgCaption);

	// check if there is a browser control on the dialog
	// already
	CWnd *pCtrl = GetDlgItem(AFX_IDC_BROWSER);
	LPUNKNOWN lpUnk;
	if(pCtrl)
	{
		lpUnk = pCtrl->GetControlUnknown();
		if (lpUnk && SUCCEEDED(lpUnk->QueryInterface(IID_IWebBrowser2, (void **) &m_pBrowserApp)))
		{
			m_wndBrowser.Attach(pCtrl->m_hWnd);
			m_bAttachedControl = TRUE;
		}
	}
	if(m_pBrowserApp == NULL)
	{
		// create the control window
		m_wndBrowser.CreateControl(CLSID_WebBrowser, NULL,
			WS_VISIBLE | WS_CHILD, rectClient, this, AFX_IDC_BROWSER);
		lpUnk = m_wndBrowser.GetControlUnknown();
		if(FAILED(lpUnk->QueryInterface(IID_IWebBrowser2, (void**) &m_pBrowserApp)))
		{
			m_wndBrowser.DestroyWindow();
			DestroyWindow();
			return TRUE;
		}
	}
	Navigate(m_strURL);

	m_pBrowserApp->put_Silent(VARIANT_TRUE);//禁止脚本错误提示  
	
	//在不同dpi的情况下,使用相同大小的显示
	if (m_iWidth > 0 && m_iHeight > 0)
	{
		SetWindowPos(NULL, 0, 0, m_iWidth, m_iHeight, SWP_NOMOVE);
	}

	if (m_dialogTitle.GetLength() > 0) SetWindowText(m_dialogTitle);

	return TRUE;  // 除非将焦点设置到控件,否则返回 TRUE
}
开发者ID:a3587556,项目名称:trochilus,代码行数:54,代码来源:HTMLContainerDlg.cpp

示例14: OnCreate

/**
	* OnCreate:
	*
	* @param lpCreateStruct 
	* @return int 
 */
int CToolShell::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (CWnd::OnCreate(lpCreateStruct) == -1)
		return -1;

	if(TRUE == m_wndBrowser.CreateControl(CLSID_WebBrowser, _T("Error"),WS_CHILD | WS_VISIBLE,CRect(0,0,600,300), this, NULL))
	{
		LPUNKNOWN lpUnk = m_wndBrowser.GetControlUnknown();
		HRESULT hr = lpUnk->QueryInterface(IID_IWebBrowser2, (void**) &m_pBrowserApp);
	}
	
	return 0;
}
开发者ID:radtek,项目名称:e-load,代码行数:19,代码来源:ToolShell.cpp

示例15: GetStartPosition

CConnectionPoint::~CConnectionPoint()
{
	POSITION pos = GetStartPosition();
	while (pos != NULL)
	{
		LPUNKNOWN pUnk = GetNextConnection(pos);
		ASSERT(pUnk != NULL);
		pUnk->Release();
	}

	if (m_pConnections != NULL)
		delete m_pConnections;
}
开发者ID:anyue100,项目名称:winscp,代码行数:13,代码来源:oleconn.cpp


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