Exemplo n.º 1
0
//---------------------------------------------------------------------
void CFlashDXPlayer::ResizePlayer(unsigned int newWidth, unsigned int newHeight)
{
	IOleInPlaceObject* pInPlaceObject = NULL;
	m_oleObject->QueryInterface(__uuidof(IOleInPlaceObject), (LPVOID*) &pInPlaceObject);

	if (pInPlaceObject != NULL)
	{
		RECT rect = { 0, 0, newWidth, newHeight };
		pInPlaceObject->SetObjectRects(&rect, &rect);
		pInPlaceObject->Release();

		m_width = newWidth;
		m_height = newHeight;

		AddDirtyRect(NULL);
	}

	if (m_alphaBlackDC)
	{
		DeleteDC(m_alphaBlackDC);
		DeleteObject(m_alphaBlackBitmap);
		DeleteDC(m_alphaWhiteDC);
		DeleteObject(m_alphaWhiteBitmap);

		m_alphaBlackDC = NULL;
		m_alphaBlackBitmap = NULL;
		m_alphaBlackBuffer = NULL;
		m_alphaWhiteDC = NULL;
		m_alphaWhiteBitmap = NULL;
		m_alphaWhiteBuffer = NULL;
	}
}
Exemplo n.º 2
0
void WINAPI duFlash::Resize(LPRECT lpRect)
{
	duHwndObj::Resize(lpRect);
	
	duRect rcFlash;
	GetRect(&rcFlash);
	
	IOleInPlaceObject *pInPlaceObject = NULL;
	if (m_pFlash && SUCCEEDED(m_pFlash->QueryInterface(IID_IOleInPlaceObject,(void**)&pInPlaceObject)))
	{
		pInPlaceObject->SetObjectRects(&rcFlash, &rcFlash);
		pInPlaceObject->Release();
	}
}
Exemplo n.º 3
0
	void on_message( UINT msg,WPARAM wp,LPARAM lp ){
		if( msg==WM_SIZE ){
			RECT rect;
			GetClientRect( hwnd,&rect );
			inPlaceObject->SetObjectRects( &rect,&rect );
		}
	}
Exemplo n.º 4
0
// @pymethod |PyIOleInPlaceObject|ReactivateAndUndo|Description of ReactivateAndUndo.
PyObject *PyIOleInPlaceObject::ReactivateAndUndo(PyObject *self, PyObject *args)
{
	IOleInPlaceObject *pIOIPO = GetI(self);
	if ( pIOIPO == NULL )
		return NULL;
	if ( !PyArg_ParseTuple(args, ":ReactivateAndUndo") )
		return NULL;
	HRESULT hr;
	PY_INTERFACE_PRECALL;
	hr = pIOIPO->ReactivateAndUndo( );
	PY_INTERFACE_POSTCALL;

	if ( FAILED(hr) )
		return OleSetOleError(hr);
	Py_INCREF(Py_None);
	return Py_None;

}
Exemplo n.º 5
0
void FlashControl::setSize(int _width, int _height)
{
	width = _width;
	height = _height;

	renderBuffer->reserve(width, height);

	IOleInPlaceObject* inPlaceObject = 0;
	oleObject->QueryInterface(__uuidof(IOleInPlaceObject), (LPVOID*)&inPlaceObject);

	if (inPlaceObject)
	{
		invalidateTotally();
		inPlaceObject->SetObjectRects(&dirtyBounds, &dirtyBounds);
		inPlaceObject->Release();
	}

}
Exemplo n.º 6
0
void nekoFlashInstance::OnSizeUpdated(int32 width, int32 height)
{
    if(!mOleObject)
        return;

    mTexture = NULL;
    mTexture = nekoNew nekoHWTexture(GetNekoNovel()->GetHWResourceManager(), width, height);
    mTexture->Refresh();

    IOleInPlaceObject* inPlaceObject = 0;
    mOleObject->QueryInterface(__uuidof(IOleInPlaceObject), (LPVOID*)&inPlaceObject);

    if(inPlaceObject)
    {
        InvalidateTotally();

        inPlaceObject->SetObjectRects(&mDirtyBounds, &mDirtyBounds);
        inPlaceObject->Release();
    }
}
Exemplo n.º 7
0
// @pymethod |PyIOleInPlaceObject|SetObjectRects|Description of SetObjectRects.
PyObject *PyIOleInPlaceObject::SetObjectRects(PyObject *self, PyObject *args)
{
	IOleInPlaceObject *pIOIPO = GetI(self);
	if ( pIOIPO == NULL )
		return NULL;
	RECT PosRect;
	RECT ClipRect;
	if ( !PyArg_ParseTuple(args, "(llll)(llll):SetObjectRects", 
		&PosRect.left, &PosRect.top, &PosRect.right, &PosRect.bottom, 
		&ClipRect.left, &ClipRect.top, &ClipRect.right, &ClipRect.bottom))
		return NULL;
	HRESULT hr;
	PY_INTERFACE_PRECALL;
	hr = pIOIPO->SetObjectRects( &PosRect, &ClipRect );
	PY_INTERFACE_POSTCALL;
	if ( FAILED(hr) )
		return OleSetOleError(hr);
	Py_INCREF(Py_None);
	return Py_None;

}
Exemplo n.º 8
0
void WebBrowserContainer::UpdateRect()
{
	IOleInPlaceObject* oleInPlaceObject = NULL;
	HRESULT hRes = this->webBrowser->QueryInterface(IID_IOleInPlaceObject, (void**)&oleInPlaceObject);
	if (FAILED(hRes))
	{
		Logger::Error("WebBrowserContainer::SetSize(), IOleObject::QueryInterface(IID_IOleInPlaceObject) failed!, error code %i", hRes);
		return;
	}

	// Update the browser window according to the holder window.
	RECT rect = {0};
	GetClientRect(this->hwnd, &rect);

	hRes = oleInPlaceObject->SetObjectRects(&rect, &rect);
	if (FAILED(hRes))
	{
		Logger::Error("WebBrowserContainer::SetSize(), IOleObject::SetObjectRects() failed!, error code %i", hRes);
		return;
	}

	oleInPlaceObject->Release();
}
Exemplo n.º 9
0
	~Win32HtmlViewRep(){
		inPlaceObject->Release();
		iBrowser->Release();
		oleObject->Close(OLECLOSE_NOSAVE);
		oleObject->Release();
	}
Exemplo n.º 10
0
void FlashControl::createControl(HMODULE _lib)
{
	site = new FlashSite();
	site->AddRef();	
	site->Init(this);
	
	// Try to load from user-supplied Flash OCX first
	if (_lib)
	{
		typedef HRESULT (__stdcall *GetClassObject)(REFCLSID rclsid, REFIID riid, LPVOID * ppv); 

		IClassFactory* factory = 0;
		GetClassObject getClassFunc = (GetClassObject)GetProcAddress(_lib, "DllGetClassObject");
		HRESULT result = getClassFunc(ShockwaveFlashObjects::CLSID_ShockwaveFlash, IID_IClassFactory, (void**)&factory);
		if (SUCCEEDED(result))
		{
			factory->CreateInstance(NULL, IID_IOleObject, (void**)&oleObject);
			factory->Release();	
		}
	}

	// If we still don't have the object, try loading from registry
	if (!oleObject)
	{
		HRESULT result = CoCreateInstance(ShockwaveFlashObjects::CLSID_ShockwaveFlash, 0, CLSCTX_INPROC_SERVER, IID_IOleObject, (void**)&oleObject);
		if (FAILED(result))
		{
			MYGUI_EXCEPT("Unable to load the Flash ActiveX control.");
		}
	}

	IOleClientSite* clientSite = 0;
	site->QueryInterface(__uuidof(IOleClientSite), (void**)&clientSite);
	oleObject->SetClientSite(clientSite);
	clientSite->Release();

	IOleInPlaceObject* inPlaceObject = 0;	
	oleObject->QueryInterface(__uuidof(IOleInPlaceObject), (LPVOID*)&inPlaceObject);			

	if (inPlaceObject)
	{
		invalidateTotally();

		inPlaceObject->SetObjectRects(&dirtyBounds, &dirtyBounds);
		inPlaceObject->Release();
	}

	oleObject->QueryInterface(__uuidof(ShockwaveFlashObjects::IShockwaveFlash), (LPVOID*)&flashInterface);

	flashInterface->PutWMode("opaque");

	oleObject->DoVerb(OLEIVERB_INPLACEACTIVATE, 0, clientSite, 0, 0, 0);
	clientSite->Release();	
		
	oleObject->QueryInterface(__uuidof(IOleInPlaceObjectWindowless), (LPVOID*)&windowlessObject);
			
	handler = new FlashHandler();
	handler->AddRef();	
	handler->Init(this);

	IViewObject* curView = 0;
	flashInterface->QueryInterface(IID_IViewObject, (void**)&curView);
}
Exemplo n.º 11
0
IEView::IEView(HWND parent, HTMLBuilder* builder, int x, int y, int cx, int cy) {
	MSG msg;
	IOleObject*   pOleObject = NULL;
    IOleInPlaceObject *pOleInPlace;
	this->parent = parent;
	this->builder = builder;
	this->smileyWindow = NULL;
	prev = next = NULL;
	hwnd = NULL;
	sink = NULL;
	pWebBrowser = NULL;
	m_pConnectionPoint = NULL;
	m_cRef = 0;
#ifdef GECKO
	if (SUCCEEDED(CoCreateInstance(CLSID_MozillaBrowser, NULL, CLSCTX_INPROC, IID_IWebBrowser2, (LPVOID*)&pWebBrowser))) {
#else
	if (SUCCEEDED(CoCreateInstance(CLSID_WebBrowser, NULL, CLSCTX_INPROC, IID_IWebBrowser2, (LPVOID*)&pWebBrowser))) {
#endif
//		pWebBrowser->put_RegisterAsBrowser(VARIANT_FALSE);
//		pWebBrowser->put_RegisterAsDropTarget(VARIANT_FALSE);
		if (SUCCEEDED(pWebBrowser->QueryInterface(IID_IOleObject, (void**)&pOleObject))) {
    		rcClient.left = x;
    		rcClient.top = y;
    		rcClient.right = x + cx;
    		rcClient.bottom = y + cy;
    		pOleObject->SetClientSite(this);
    		pOleObject->DoVerb(OLEIVERB_INPLACEACTIVATE, &msg, this, 0, parent, &rcClient);
    		pOleObject->Release();
   		} else {
  			MessageBox(NULL,"IID_IOleObject failed.","RESULT",MB_OK);
   		}

		if (SUCCEEDED(pWebBrowser->QueryInterface(IID_IOleInPlaceObject, (void**)&pOleInPlace))) {
    		pOleInPlace->GetWindow(&hwnd);
    		pOleInPlace->Release();
		} else {
  			MessageBox(NULL,"IID_IOleInPlaceObject failed.","RESULT",MB_OK);
		}

		LONG style = GetWindowLong(hwnd, GWL_EXSTYLE);
		style |= (WS_EX_STATICEDGE);
		SetWindowLong(hwnd,GWL_EXSTYLE,style);

   		IConnectionPointContainer* pCPContainer;
	   // Step 1: Get a pointer to the connection point container.
   		if (SUCCEEDED(pWebBrowser->QueryInterface(IID_IConnectionPointContainer,
                                      		(void**)&pCPContainer))) {
	      // m_pConnectionPoint is defined like this:
	      // Step 2: Find the connection point.
      		if (SUCCEEDED(pCPContainer->FindConnectionPoint(DIID_DWebBrowserEvents2,
	                                             &m_pConnectionPoint))) {
	         // Step 3: Advise the connection point that you
	         // want to sink its events.
	            sink = new IEViewSink();
#ifndef GECKO
	         	if (FAILED(m_pConnectionPoint->Advise((IUnknown *)sink, &m_dwCookie)))     {
	            	MessageBox(NULL, "Failed to Advise", "C++ Event Sink", MB_OK);
	         	}
#endif
	      	}
      		pCPContainer->Release();
   		}
#ifndef GECKO
		setUserWndProc((WNDPROC)SetWindowLong(hwnd, GWL_WNDPROC, (LONG) IEViewWindowProcedure));
#endif
    }
    EnterCriticalSection(&mutex);
	next = list;
	if (next != NULL) {
	    next->prev = this;
	}
	list = this;
	LeaveCriticalSection(&mutex);
	clear();
}

IEView::IEView(HWND parent, SmileyWindow* smileyWindow, int x, int y, int cx, int cy) {
	MSG msg;
	IOleObject*   pOleObject = NULL;
    IOleInPlaceObject *pOleInPlace;
	this->parent = parent;
	builder = NULL;
	this->smileyWindow = smileyWindow;
	prev = next = NULL;
	hwnd = NULL;
	sink = NULL;
	pWebBrowser = NULL;
	m_pConnectionPoint = NULL;
	m_cRef = 0;

#ifdef GECKO
	if (SUCCEEDED(CoCreateInstance(CLSID_MozillaBrowser, NULL, CLSCTX_INPROC, IID_IWebBrowser2, (LPVOID*)&pWebBrowser))) {
#else
	if (SUCCEEDED(CoCreateInstance(CLSID_WebBrowser, NULL, CLSCTX_INPROC, IID_IWebBrowser2, (LPVOID*)&pWebBrowser))) {
#endif
//		pWebBrowser->put_RegisterAsBrowser(VARIANT_FALSE);
//		pWebBrowser->put_RegisterAsDropTarget(VARIANT_FALSE);
		if (SUCCEEDED(pWebBrowser->QueryInterface(IID_IOleObject, (void**)&pOleObject))) {
    		rcClient.left = x;
    		rcClient.top = y;
    		rcClient.right = x + cx;
    		rcClient.bottom = y + cy;
    		pOleObject->SetClientSite(this);
    		pOleObject->DoVerb(OLEIVERB_INPLACEACTIVATE, &msg, this, 0, parent, &rcClient);
    		pOleObject->Release();
   		} else {
  			MessageBox(NULL,"IID_IOleObject failed.","RESULT",MB_OK);
   		}

		if (SUCCEEDED(pWebBrowser->QueryInterface(IID_IOleInPlaceObject, (void**)&pOleInPlace))) {
    		pOleInPlace->GetWindow(&hwnd);
    		pOleInPlace->Release();
		} else {
  			MessageBox(NULL,"IID_IOleInPlaceObject failed.","RESULT",MB_OK);
		}

   		IConnectionPointContainer* pCPContainer;
	   // Step 1: Get a pointer to the connection point container.
   		if (SUCCEEDED(pWebBrowser->QueryInterface(IID_IConnectionPointContainer,
                                      		(void**)&pCPContainer))) {
	      // m_pConnectionPoint is defined like this:
	      // Step 2: Find the connection point.
      		if (SUCCEEDED(pCPContainer->FindConnectionPoint(DIID_DWebBrowserEvents2,
	                                             &m_pConnectionPoint))) {
	         // Step 3: Advise the connection point that you
	         // want to sink its events.
	            sink = new IEViewSink(smileyWindow);
#ifndef GECKO
	         	if (FAILED(m_pConnectionPoint->Advise((IUnknown *)sink, &m_dwCookie)))     {
	            	MessageBox(NULL, "Failed to Advise", "C++ Event Sink", MB_OK);
	         	}
#endif
	      	}
      		pCPContainer->Release();
   		}
    }
	clear();
}

IEView::~IEView() {
	IOleObject*   pOleObject = NULL;
	if (SUCCEEDED(pWebBrowser->QueryInterface(IID_IOleObject, (void**)&pOleObject))) {
		pOleObject->SetClientSite(NULL);
		pOleObject->Release();
	} else {
		MessageBox(NULL,"IID_IOleObject failed.","RESULT",MB_OK);
	}
    EnterCriticalSection(&mutex);
	if (list == this) {
		list = next;
	} else if (prev!=NULL) {
		prev->next = next;
	}
	if (next != NULL) {
		next->prev = prev;
	}
	LeaveCriticalSection(&mutex);
	if (builder != NULL) {
		delete builder;
		builder = NULL;
	}
	if (m_pConnectionPoint != NULL) {
        m_pConnectionPoint->Unadvise(m_dwCookie);
        m_pConnectionPoint->Release();
	}
	if (sink != NULL) {
		delete sink;
	}
	pWebBrowser->Release();
	DestroyWindow(hwnd);
}

void IEView::setUserWndProc(WNDPROC wndProc) {
	userWndProc = wndProc;
}

WNDPROC IEView::getUserWndProc() {
	return userWndProc;
}

// IUnknown
STDMETHODIMP IEView::QueryInterface(REFIID riid, PVOID *ppv) {
	*ppv=NULL;
	if (IID_IUnknown==riid)
		*ppv=this;
	if (IID_IOleClientSite==riid)
		*ppv=(IOleClientSite*)this;//Unknown)m_pIOleClientSite;
	if (IID_IOleWindow==riid || IID_IOleInPlaceSite==riid)
		*ppv=(IOleInPlaceSite*)this;//m_pIOleIPSite;
	if (IID_IDocHostUIHandler==riid)
		*ppv=(IDocHostUIHandler*)this;//m_pIOleIPSite;
	if (NULL!=*ppv) {
		((LPUNKNOWN)*ppv)->AddRef();
		return NOERROR;
	}
	return E_NOINTERFACE;
}
Exemplo n.º 12
0
IEView::IEView(HWND parent, HTMLBuilder* builder, int x, int y, int cx, int cy) {
	MSG msg;
	IOleObject*   pOleObject = NULL;
	IOleInPlaceObject *pOleInPlace;
	isContactSet = false;
	this->parent = parent;
	this->builder = builder;
	prev = next = NULL;
	hwnd = NULL;
	sink = NULL;
	pWebBrowser = NULL;
	m_pConnectionPoint = NULL;
	m_cRef = 0;
	selectedText = NULL;
	getFocus = false;
	rcClient.left = x;
	rcClient.top = y;
	rcClient.right = x + cx;
	rcClient.bottom = y + cy;
	if (SUCCEEDED(CoCreateInstance(CLSID_WebBrowser, NULL, CLSCTX_INPROC, IID_IWebBrowser2, (LPVOID*)&pWebBrowser))) {
		if (SUCCEEDED(pWebBrowser->QueryInterface(IID_IOleObject, (void**)&pOleObject))) {
			pOleObject->SetClientSite(this);
			pOleObject->DoVerb(OLEIVERB_INPLACEACTIVATE, &msg, this, 0, this->parent, &rcClient);
			pOleObject->Release();
		} else {
			MessageBox(NULL, TranslateT("IID_IOleObject failed."), TranslateT("RESULT"), MB_OK);
		}

		if (SUCCEEDED(pWebBrowser->QueryInterface(IID_IOleInPlaceObject, (void**)&pOleInPlace))) {
			pOleInPlace->GetWindow(&hwnd);
			pOleInPlace->Release();
		} else {
			MessageBox(NULL, TranslateT("IID_IOleInPlaceObject failed."), TranslateT("RESULT"), MB_OK);
		}

		setBorder();
		IConnectionPointContainer* pCPContainer;
		// Step 1: Get a pointer to the connection point container.
		if (SUCCEEDED(pWebBrowser->QueryInterface(IID_IConnectionPointContainer,
											(void**)&pCPContainer))) {
		// m_pConnectionPoint is defined like this:
		// Step 2: Find the connection point.
			if (SUCCEEDED(pCPContainer->FindConnectionPoint(DIID_DWebBrowserEvents2,
												 &m_pConnectionPoint))) {
			 // Step 3: Advise the connection point that you
			 // want to sink its events.
				sink = new IEViewSink(this);
			 	if (FAILED(m_pConnectionPoint->Advise((IUnknown *)sink, &m_dwCookie)))	 {
					MessageBox(NULL, TranslateT("Failed to Advise"), TranslateT("C++ Event Sink"), MB_OK);
			 	}
			}
			pCPContainer->Release();
		}
		setMainWndProc((WNDPROC)SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR) IEViewWindowProcedure));
	}
	{
		mir_cslock lck(mutex);
		next = list;
		if (next != NULL)
			next->prev = this;
		list = this;
	}

	pWebBrowser->put_RegisterAsDropTarget(VARIANT_FALSE);
}
Exemplo n.º 13
0
void FlashControl::createControl()
{
	site = new Impl::FlashSite();
	site->AddRef();	
	site->Init(this);
	
	HMODULE flashLib = HikariManager::Get().flashLib;
	
	// Try to load from user-supplied Flash OCX first
	if(flashLib)
	{
		IClassFactory* factory = 0;
		GetClassObject getClassFunc = (GetClassObject)GetProcAddress(flashLib, "DllGetClassObject");
		HRESULT result = getClassFunc(ShockwaveFlashObjects::CLSID_ShockwaveFlash, IID_IClassFactory, (void**)&factory);
		if(SUCCEEDED(result))
		{
			factory->CreateInstance(NULL, IID_IOleObject, (void**)&oleObject);
			factory->Release();	
		}
	}

	// If we still don't have the object, try loading from registry
	if(!oleObject)
	{
		HRESULT result = CoCreateInstance(ShockwaveFlashObjects::CLSID_ShockwaveFlash, 0, CLSCTX_INPROC_SERVER, IID_IOleObject, (void**)&oleObject);
		if(FAILED(result))
			OGRE_EXCEPT(Ogre::Exception::ERR_RT_ASSERTION_FAILED, "Unable to load the Flash ActiveX control.", "FlashControl::createControl");
	}

	IOleClientSite* clientSite = 0;
	site->QueryInterface(__uuidof(IOleClientSite), (void**)&clientSite);
	oleObject->SetClientSite(clientSite);
	clientSite->Release();

	IOleInPlaceObject* inPlaceObject = 0;	
	oleObject->QueryInterface(__uuidof(IOleInPlaceObject), (LPVOID*)&inPlaceObject);			

	if(inPlaceObject)
	{
		invalidateTotally();

		inPlaceObject->SetObjectRects(&dirtyBounds, &dirtyBounds);
		inPlaceObject->Release();
	}

	oleObject->QueryInterface(__uuidof(ShockwaveFlashObjects::IShockwaveFlash), (LPVOID*)&flashInterface);

	flashInterface->PutWMode("opaque");

	oleObject->DoVerb(OLEIVERB_INPLACEACTIVATE, 0, clientSite, 0, 0, 0);
	clientSite->Release();	
		
	oleObject->QueryInterface(__uuidof(IOleInPlaceObjectWindowless), (LPVOID*)&windowlessObject);
			
	handler = new Impl::FlashHandler();
	handler->AddRef();	
	handler->Init(this);

	IViewObject* curView = 0;
	flashInterface->QueryInterface(IID_IViewObject, (void**)&curView);
}