示例#1
0
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);
}
示例#2
0
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;
}
示例#3
0
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
}
示例#4
0
void reportError(
	int errorType, LPUNKNOWN pIUnknown, const char * pszMessage )
{
	HRESULT rc;
	assert( pIUnknown != NULL );

	IDgnErrorPtr pIDgnError;
	rc = pIUnknown->QueryInterface(
		__uuidof(IDgnError), (void**)&pIDgnError );
	if( FAILED(rc) )
	{
		reportError( errorType, pszMessage );
		return;
	}

	char szNatSpeakErr[ 512 ];
	DWORD dwSizeNeeded;
	rc = pIDgnError->ErrorMessageGet( szNatSpeakErr, 512, &dwSizeNeeded );
	if( rc != E_BUFFERTOOSMALL && FAILED(rc) )
	{
		reportError( errorType, pszMessage );
		return;
	}

	char szErrorMsg[ 1024 ];
	sprintf( szErrorMsg, "%s (%s)", pszMessage, szNatSpeakErr );
	PyErr_SetString( ErrObjects[errorType], szErrorMsg );
}
示例#5
0
BOOL AFXAPI _AfxLoadObjectFromStreamedPropset(LPUNKNOWN lpUnknown, LPSTREAM lpStream)
{
	ASSERT_POINTER(lpUnknown, IUnknown);
	ASSERT_POINTER(lpStream, IStream);

	BOOL bSuccess = FALSE;
	LPDATAOBJECT pDataObj = NULL;

	if (SUCCEEDED(lpUnknown->QueryInterface(IID_IDataObject,
			(LPVOID*)&pDataObj)))
	{
		ASSERT_POINTER(pDataObj, IDataObject);

		// Set the persistent propset format on the object.

		FORMATETC formatEtc;
		STGMEDIUM stgMedium;
		formatEtc.cfFormat = _AfxGetClipboardFormatPersistPropset();
		formatEtc.ptd = NULL;
		formatEtc.dwAspect = DVASPECT_CONTENT;
		formatEtc.lindex = -1;
		formatEtc.tymed = TYMED_ISTREAM;

		stgMedium.tymed = TYMED_ISTREAM;
		stgMedium.pstm = lpStream;
		stgMedium.pUnkForRelease = NULL;

		bSuccess = SUCCEEDED(pDataObj->SetData(&formatEtc, &stgMedium, FALSE));

		pDataObj->Release();
	}

	return bSuccess;
}
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();
    }



}
示例#7
0
void CMFCBindCntrItem::LoadFromMoniker(LPUNKNOWN pUnk, OLECHAR* szwName)
{
	HRESULT hr;
	// Ask the system for a URL Moniker
	IMoniker* pIMoniker;
	hr = CreateURLMoniker(NULL, (LPWSTR)szwName, &pIMoniker);
	if ( SUCCEEDED(hr) )
	{
		// Get the IPersistMoniker interface
		IPersistMoniker* pPMk;
		hr = pUnk->QueryInterface(
								IID_IPersistMoniker,
								(void **)&pPMk);
		if ( SUCCEEDED(hr) )
		{
				// note: do not register our BSC when calling IPM::Load directly
			IBindCtx *pBCtx;
			hr = CreateBindCtx(0, &pBCtx);
			if ( SUCCEEDED(hr) )
			{
				// Call Load on the IPersistMoniker
				hr = pPMk->Load(FALSE, pIMoniker, pBCtx, STGM_READ);
					pBCtx->Release();
			}
			pPMk->Release();
		}
		pIMoniker->Release( );
	}
}
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();

}
示例#9
0
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();
	

}
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;
}
示例#11
0
HRESULT CDataObjectViewer::OnView(HWND hwndParent, REFIID riid, LPUNKNOWN punk)
{
	SCODE sc = NOERROR ;

	ASSERT(hwndParent);
	ENSURE(punk);

	if (riid != IID_IDataObject)
	{
		AfxMessageBox( _T("IDataObject interface viewer only supports IID_IDataObject") ) ;
		return E_INVALIDARG ;
	}

	IDataObject* pdataobj = NULL ;
	sc = punk->QueryInterface( riid, (void**)&pdataobj ) ;
	if (FAILED(sc))
	{
		AfxMessageBox( _T("Object does not support IDataObject") ) ;
		return E_UNEXPECTED ;
	}

	CIDataObjectDlg* pdlg ;
	pdlg = new CIDataObjectDlg( hwndParent, pdataobj, riid, _T("") ) ;

	if (pdlg)
	{
		pdlg->DoModal() ;
		delete pdlg ;
	}

	pdataobj->Release() ;

	return sc ;
}
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();



}
示例#13
0
BOOL SimpleBrowser::Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID)
{
    // create browser control window as child of this window; 
	// this window sinks events from control
	//BOOL results = CWnd::Create(AfxRegisterWndClass(CS_HREDRAW | CS_VREDRAW),
	//                         NULL,
	//						 dwStyle,
	//						 rect,
	//						 pParentWnd,
	//						 nID);
	BOOL results = CWnd::Create(_T("#32770"),
		NULL,
		dwStyle,
		rect,
		pParentWnd,
		nID);
    if (!results) 
		return FALSE;
	//create the original window
	m_pBrowserWnd = new CWnd;
    results = m_pBrowserWnd->CreateControl(CLSID_WebBrowser, NULL, (WS_VISIBLE | WS_TABSTOP),
		CRect(0,0,rect.right - rect.left,rect.bottom - rect.top), this, AFX_IDW_PANE_FIRST);
    if (!results) 
	{
        DestroyWindow();
        return FALSE;
    }
    // get control interfaces
	m_pBrowser = NULL;
    LPUNKNOWN pUnknown = m_pBrowserWnd->GetControlUnknown();
	HRESULT hr = S_FALSE;
	if (pUnknown != NULL)
	{
		hr = pUnknown->QueryInterface(IID_IWebBrowser2,(void **)&m_pBrowser);
		if (SUCCEEDED(hr)) 
			hr = pUnknown->QueryInterface(IID_IDispatch,(void **)&m_pBrowserDispatch);
	}
    if (!SUCCEEDED(hr)) {
        m_pBrowserWnd->DestroyWindow();
		delete m_pBrowserWnd;
		m_pBrowserWnd = NULL;
        DestroyWindow();
        return FALSE;        
    }
    return TRUE;
}
示例#14
0
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;
}
示例#15
0
文件: oleunk.cpp 项目: Rupan/winscp
LPUNKNOWN AFXAPI _AfxQueryInterface(LPUNKNOWN lpUnknown, REFIID iid)
{
	ASSERT(lpUnknown != NULL);

	LPUNKNOWN lpW = NULL;
	if (lpUnknown->QueryInterface(iid, (LPLP)&lpW) != S_OK)
		return NULL;

	return lpW;
}
示例#16
0
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
}
示例#17
0
/**
	* 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;
}
示例#18
0
////////////////////////////////////////////////
//
// 初始化TOOLTIP控件
//
void CDataGridEx::InitToolTipControl()
{
	if(m_RecordCount<0)
	{
		LPUNKNOWN pUnknown;
		HRESULT hr;
		_RecordsetPtr IRecordset;

		pUnknown=GetDataSource();
		
		if(pUnknown==NULL)
			return;

		try
		{
			hr=pUnknown->QueryInterface(__uuidof(Recordset),(void**)&IRecordset);

			pUnknown->Release();

			if(FAILED(hr))
			{
				throw _com_error(hr);
			}

			m_RecordCount=IRecordset->GetRecordCount();
		}
		catch(_com_error &e)
		{
			AfxMessageBox(e.ErrorMessage());
		}
	}

	if(IsWindow(m_ToolTip.GetSafeHwnd()))
		return;

	m_ToolTip.Create(this);
	
	TOOLINFO ToolInfo;

	memset(&ToolInfo,0,sizeof(TOOLINFO));

	ToolInfo.cbSize=sizeof(TOOLINFO);
	ToolInfo.uFlags=TTF_TRACK|TTF_IDISHWND| TTF_ABSOLUTE;
	ToolInfo.hwnd=this->m_hWnd;
	ToolInfo.uId=(UINT)this->m_hWnd;
	ToolInfo.lpszText=LPSTR_TEXTCALLBACK;

	m_ToolTip.SendMessage(TTM_ADDTOOL,0,(LPARAM)&ToolInfo);
}
示例#19
0
BOOL CDriverDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	// create the calculator object that we'll drive through OLE automation
	COleException e;
	CLSID clsid;
	if (CLSIDFromProgID(OLESTR("mfccalc.calculator"), &clsid) != NOERROR)
	{
		AfxMessageBox(IDP_UNABLE_TO_CREATE);
		EndDialog(IDABORT);
		return FALSE;
	}

	// try to get the active calculator before creating a new one
	LPUNKNOWN lpUnk;
	LPDISPATCH lpDispatch;
	if (GetActiveObject(clsid, NULL, &lpUnk) == NOERROR)
	{
		HRESULT hr = lpUnk->QueryInterface(IID_IDispatch,
			(LPVOID*)&lpDispatch);
		lpUnk->Release();
		if (hr == NOERROR)
			m_calc.AttachDispatch(lpDispatch, TRUE);
	}

	// if not dispatch ptr attached yet, need to create one
	if (m_calc.m_lpDispatch == NULL &&
		!m_calc.CreateDispatch(clsid, &e))
	{
		AfxMessageBox(IDP_UNABLE_TO_CREATE);
		EndDialog(IDABORT);
		return FALSE;
	}

	// attempt to make it visible
	m_calc.SetVisible(TRUE);
	if (!m_calc.GetVisible())
	{
		AfxMessageBox(IDP_UNABLE_TO_SHOW);
		EndDialog(IDABORT);
		return FALSE;
	}

	// refresh display to contents of the automation calculator
	OnRefresh();

	return TRUE;  // return TRUE  unless you set the focus to a control
}
示例#20
0
BOOL tOleHandler::ObjectInitialize(LPUNKNOWN pObj)
    {
    HRESULT         hr;
    FORMATETC fe;

    SETDefFormatEtc(fe, 0, TYMED_NULL);
    LPFORMATETC pFE = &fe;


    if (NULL==pObj || NULL==pFE)
        return FALSE;

    m_pObj=pObj;
    m_fe=*pFE;
    m_fe.ptd=NULL;
    m_dwState=TENANTSTATE_DEFAULT;

    m_pIViewObject2=NULL;
    hr=pObj->QueryInterface(IID_IViewObject2
        , (LPVOID*)&m_pIViewObject2);

    if (FAILED(hr))
        return FALSE;

    /*
     * Get the MiscStatus bits and check for OLEMISC_ONLYICONIC.
     * If set, force dwAspect in m_fe to DVASPECT_ICON so we
     * remember to draw it properly and do extents right.
     */
    m_pIOleObject->GetMiscStatus(m_fe.dwAspect, &m_grfMisc);


    //CHAPTER24MOD
    //Run the object if it says to do so
    if (OLEMISC_ALWAYSRUN & m_grfMisc)
        OleRun(pObj);
    //End CHAPTER24MOD



    //CHAPTER24MOD
    //Go try initializing control-related things.
    ControlInitialize();
    //End CHAPTER24MOD

    return TRUE;
    }
示例#21
0
void CBetaPatchClientDlg::CreateWebControl( LPCTSTR szURL )
{
	// AFX_IDW_PANE_FIRST is a safe but arbitrary ID
#ifdef __LANG_JAP
	//JAPAN 패치 클라이언트 이미지 변경관련 웹 크기 조절.	
	if (!m_wndBrowser.CreateControl(CLSID_WebBrowser, "", WS_VISIBLE | WS_CHILD, CRect(14, 14, 466, 447), 
		this, AFX_IDW_PANE_FIRST))		
#else //__LANG_JAP
#if __CURRENT_LANG == LANG_KOR //공지사항 크기 확장 관련 조정.
	if (!m_wndBrowser.CreateControl(CLSID_WebBrowser, 
			"",	WS_VISIBLE | WS_CHILD, CRect(26, 190, 452, 447), this, AFX_IDW_PANE_FIRST))
#else //LANG_KOR
	if (!m_wndBrowser.CreateControl(CLSID_WebBrowser, 
		                            "",
				                    WS_VISIBLE | WS_CHILD, 
									CRect(26, 263, 452, 447), 
									this, 
									AFX_IDW_PANE_FIRST))
#endif //LANG_KOR
#endif //__LANG_JAP
	{
		return;
	}

	IWebBrowser2* pBrowser;
	LPUNKNOWN lpUnk = m_wndBrowser.GetControlUnknown();
	HRESULT hr = lpUnk->QueryInterface(IID_IWebBrowser2, (void**) &pBrowser);
	if (SUCCEEDED(hr))
	{
		CString strURL( szURL );
		BSTR bstrURL = strURL.AllocSysString();

		COleSafeArray vPostData;
		LPCTSTR lpszTargetFrameName = NULL;
		LPCTSTR lpszHeaders = NULL;

		pBrowser->Navigate(bstrURL,
			COleVariant((long) 0, VT_I4),
			COleVariant(lpszTargetFrameName, VT_BSTR),
			vPostData,
			COleVariant(lpszHeaders, VT_BSTR));
	}
}
示例#22
0
文件: xarraydb.cpp 项目: DeegC/10d
BOOL IXArrayDB::CreateDispatch(REFCLSID clsid, COleException* pError )
{
   ASSERT(m_lpDispatch == NULL);

   m_bAutoRelease = TRUE;  // good default is to auto-release

   // create an instance of the object
   LPUNKNOWN lpUnknown = NULL;
   HRESULT sc = CreateInstanceLic( this->GetCLSID(), NULL,
                                   CLSCTX_ALL | CLSCTX_REMOTE_SERVER,
                                   IID_IUnknown, (zPVOID*)&lpUnknown);
   if (sc == E_INVALIDARG)
   {
      // may not support CLSCTX_REMOTE_SERVER, so try without
      sc = CreateInstanceLic(this->GetCLSID(), NULL, CLSCTX_ALL & ~CLSCTX_REMOTE_SERVER,
         IID_IUnknown, (zPVOID*)&lpUnknown);
   }
   if (FAILED(sc))
      goto Failed;

   // make sure it is running
   sc = OleRun(lpUnknown);
   if (FAILED(sc))
      goto Failed;

   // query for IDispatch interface
   sc = lpUnknown->QueryInterface( IID_IDispatch, (zPVOID*) &m_lpDispatch);
   if (m_lpDispatch == NULL)
      goto Failed;

   lpUnknown->Release();
   ASSERT(m_lpDispatch != NULL);
   return TRUE;

Failed:
   lpUnknown->Release();
   if (pError != NULL)
      pError->m_sc = sc;
   TRACE1("Warning: CreateDispatch returning scode = %s.\n",
      AfxGetFullScodeString(sc));
   return FALSE;
}
示例#23
0
void VLCConnectionPoint::firePropChangedEvent(DISPID dispId)
{
    map<DWORD,LPUNKNOWN>::iterator end = _connections.end();
    map<DWORD,LPUNKNOWN>::iterator iter = _connections.begin();

    while( iter != end )
    {
        LPUNKNOWN pUnk = iter->second;
        if( NULL != pUnk )
        {
            IPropertyNotifySink *pPropSink;
            if( SUCCEEDED(pUnk->QueryInterface(IID_IPropertyNotifySink, (LPVOID *)&pPropSink)) )
            {
                pPropSink->OnChanged(dispId);
                pPropSink->Release();
            }
        }
        ++iter;
    }
};
示例#24
0
void VLCConnectionPoint::fireEvent(DISPID dispId, DISPPARAMS *pDispParams)
{
    map<DWORD,LPUNKNOWN>::iterator end = _connections.end();
    map<DWORD,LPUNKNOWN>::iterator iter = _connections.begin();

    while( iter != end )
    {
        LPUNKNOWN pUnk = iter->second;
        if( NULL != pUnk )
        {
            IDispatch *pDisp;
            if( SUCCEEDED(pUnk->QueryInterface(IID_IDispatch, (LPVOID *)&pDisp)) )
            {
                pDisp->Invoke(dispId, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, pDispParams, NULL, NULL, NULL);
                pDisp->Release();
            }
        }
        ++iter;
    }
};
示例#25
0
文件: inspectors.cpp 项目: gpg/gpgol
/* Return the MAPI message object of then inspector from a button's
   instance id. */
static LPMESSAGE
get_message_from_button (unsigned long instid, LPDISPATCH *r_inspector)
{
  HRESULT hr;
  LPDISPATCH inspector, obj;
  LPUNKNOWN  unknown;
  LPMESSAGE message = NULL;
  
  if (r_inspector)
    *r_inspector = NULL;
  inspector = get_inspector_from_instid (instid);
  if (inspector)
    {
      obj = get_oom_object (inspector, "get_CurrentItem");
      if (!obj)
        log_error ("%s:%s: error getting CurrentItem", SRCNAME, __func__);
      else
        {
          unknown = get_oom_iunknown (obj, "MAPIOBJECT");
          if (!unknown)
            log_error ("%s:%s: error getting MAPI object", SRCNAME, __func__);
          else
            {
              hr = unknown->QueryInterface (IID_IMessage, (void**)&message);
              if (hr != S_OK || !message)
                {
                  message = NULL;
                  log_error ("%s:%s: error getting IMESSAGE: hr=%#lx",
                             SRCNAME, __func__, hr);
                }
              unknown->Release ();
            }
          obj->Release ();
        }
      if (r_inspector)
        *r_inspector = inspector;
      else
        inspector->Release ();
    }
  return message;
}
示例#26
0
bool CHtmlCtrl::Create(CWnd* pParent, const RECT& rc, LPCTSTR pszHomeURL /*= NULL*/, bool fBtnText /*= true*/)
{
    AfxEnableControlContainer();
    CRect rcClient(rc);

    if (!CreateControl(CLSID_WebBrowser, NULL, 
            WS_VISIBLE | WS_CHILD, rcClient, pParent, AFX_IDW_PANE_FIRST)) {
        TRACE0("Unable to create control");
        return false;
    }

    LPUNKNOWN lpUnk = GetControlUnknown();
    HRESULT hr = lpUnk->QueryInterface(IID_IWebBrowser2, (void**) &m_pBrowser);
    if (FAILED(hr)) {
        m_pBrowser = NULL;
        TRACE0("Unable to create web browser");
        return false;
    }

    return true;
}
示例#27
0
文件: viewhtml.cpp 项目: Rupan/winscp
BOOL CHtmlView::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName,
						DWORD dwStyle, const RECT& rect, CWnd* pParentWnd,
						UINT nID, CCreateContext* pContext)
{
	// create the view window itself
	m_pCreateContext = pContext;
	if (!CView::Create(lpszClassName, lpszWindowName,
				dwStyle, rect, pParentWnd,  nID, pContext))
	{
		return FALSE;
	}

	AfxEnableControlContainer();

	RECT rectClient;
	GetClientRect(&rectClient);

	// create the control window
	// AFX_IDW_PANE_FIRST is a safe but arbitrary ID
	if (!m_wndBrowser.CreateControl(CLSID_WebBrowser, lpszWindowName,
				WS_VISIBLE | WS_CHILD, rectClient, 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 TRUE;
}
示例#28
0
void CEx24dView::OnExceloleLoad() 
{   // if Excel is already running, attach to it, otherwise start it
   LPDISPATCH pDisp;
   LPUNKNOWN pUnk;
   CLSID clsid;
   TRACE("Entering CEx24dView::OnExcelLoad\n");
   BeginWaitCursor();
   ::CLSIDFromProgID(L"Excel.Application.8", &clsid); // from registry
   if(::GetActiveObject(clsid, NULL, &pUnk) == S_OK) {
      VERIFY(pUnk->QueryInterface(IID_IDispatch,
            (void**) &pDisp) == S_OK);
      m_app.AttachDispatch(pDisp);
      pUnk->Release();
      TRACE(" attach complete\n");
  } 
   else {
	   if(!m_app.CreateDispatch("Excel.Application.8")) {
			AfxMessageBox("Excel 97 program not found");
	   }
       TRACE(" create complete\n");
   }
   EndWaitCursor();
}
示例#29
0
/*******************************************************************************
  Function Name  : OnInitialUpdate
  Input(s)       : -
  Output         : -
  Functionality  : Initialises UI components
  Member of      : CGraphRightView
  Author(s)      : Raja N
  Date Created   : 12/12/2004
  Modifications  :
*******************************************************************************/
void CGraphRightView::OnInitialUpdate()
{
    // Call parent class handler
    CFormView::OnInitialUpdate();
    AfxEnableControlContainer();

    m_pParentWnd = (CGraphChildFrame*)pomGetParentWindow();

    //Get the CWnd reference to the DMGraph ActiveX control
    m_pWndGraphCtrl = GetDlgItem(IDC_DMGRAPH_CTRL);

    LPUNKNOWN pUnk = m_pWndGraphCtrl->GetControlUnknown();
    pUnk->QueryInterface(IID_IDMGraphCtrl, (void**) &m_pDMGraphCtrl);
    if (  m_pDMGraphCtrl !=nullptr )
    {
        m_pParentWnd->m_pDMGraphCtrl = m_pDMGraphCtrl;
    }
    else
    {
        m_pParentWnd->m_pDMGraphCtrl = nullptr;
    }
    m_pParentWnd->m_pomRightView = this;
}
示例#30
0
void CDataGridEx::OnSortDesc()
{
	CString strTemp;
	_RecordsetPtr IRecordset;
	LPUNKNOWN pUnknown;
	HRESULT hr;

	try
	{
		pUnknown=this->GetDataSource();

		hr=pUnknown->QueryInterface(__uuidof(_RecordsetPtr),(void**)&IRecordset);

		if(FAILED(hr))
		{
			pUnknown->Release();
			AfxMessageBox(_com_error(hr).ErrorMessage());
			return;
		}

		pUnknown->Release();

		strTemp=GetColumns().GetItem(_variant_t(m_SelectCol)).GetCaption();

		strTemp+=_T(" DESC");
		IRecordset->Sort=_bstr_t(strTemp);
	}
	catch (_com_error &e)
	{
		CString strMsg;
		strMsg.Format("%s:%d %s", __FILE__, __LINE__, (LPSTR)e.Description());
		AfxMessageBox(strMsg);
	}

	
	return;
}