Exemplo n.º 1
0
void tLuaCOM::releaseConnections() {
	if(conn_point==NULL)
		return;
	
	conn_point->Release();
	IConnectionPointContainer *pcpc;

    HRESULT hr = pdisp->QueryInterface(IID_IConnectionPointContainer, (void **) &pcpc);

    if(FAILED(hr))
    {
	    return;
    }

	IEnumConnectionPoints *pecp;

	hr = pcpc->EnumConnectionPoints(&pecp);
	pcpc->Release();

    if(FAILED(hr))
    {
	    return;
    }

	pecp->Reset();

	IConnectionPoint *pcp;
	ULONG fetched = 0;

	hr = pecp->Next(1, &pcp, &fetched);
	while(SUCCEEDED(hr) && fetched) {
		IEnumConnections *pec;
		hr = pcp->EnumConnections(&pec);
		if(SUCCEEDED(hr)) {
			pec->Reset();
			CONNECTDATA conn;
			ULONG conn_fetched = 0;
			hr = pec->Next(1, &conn, &conn_fetched);
			while(SUCCEEDED(hr) && conn_fetched) {
				pcp->Unadvise(conn.dwCookie);
				hr = pec->Next(1, &conn, &conn_fetched);
			}
			pec->Release();
		}
        pcp->Release();
  	    pecp->Next(1, &pcp, &fetched);
	}
	
	pecp->Release();
}
Exemplo n.º 2
0
STDMETHODIMP 
CoCormanLisp::ReplaceSelection(char* text, long numChars)
{
	HRESULT hr = S_OK;
	IEnumConnections* pEnum = 0;
	CONNECTDATA cd = { 0 };
	ICormanLispStatusMessage* messager = 0;

	if (!m_pcpPointSink)
		return hr;

	if (FAILED(m_pcpPointSink->EnumConnections(&pEnum)))
		return hr;

	while (pEnum->Next(1, &cd, NULL) == NOERROR)
	{
		if (SUCCEEDED(cd.pUnk->QueryInterface(IID_ICormanLispStatusMessage, 
				(void**)&messager)))
		{
			hr = messager->ReplaceSelection(text, numChars);
			messager->Release();
		}
		cd.pUnk->Release();
	}
	pEnum->Release();
	return hr;
}
Exemplo n.º 3
0
STDMETHODIMP CoCormanLisp::GetAppMainWindow(HWND* appMainWindow)
{
	HRESULT hr = S_OK;
	IEnumConnections* pEnum = 0;
	CONNECTDATA cd = { 0 };
	ICormanLispTextOutput* output = 0;

	*appMainWindow = 0;

	if (!m_pcpPointSink)
		return hr;

	if (FAILED(m_pcpPointSink->EnumConnections(&pEnum)))
		return hr;

	while (pEnum->Next(1, &cd, NULL) == NOERROR)
	{
		if (SUCCEEDED(cd.pUnk->QueryInterface(IID_ICormanLispTextOutput, 
				(void**)&output)))
		{
			hr = output->GetAppMainWindow(appMainWindow);
			output->Release();
		}
		cd.pUnk->Release();
	}
	pEnum->Release();
	return hr;
}
Exemplo n.º 4
0
STDMETHODIMP CoCormanLisp::OpenEditWindow(char* file, HWND* wnd)
{
	HRESULT hr = S_OK;
	IEnumConnections* pEnum = 0;
	CONNECTDATA cd = { 0 };
	ICormanLispStatusMessage* messager = 0;

	if (!m_pcpPointSink)
		return hr;

	if (FAILED(m_pcpPointSink->EnumConnections(&pEnum)))
		return hr;

	while (pEnum->Next(1, &cd, NULL) == NOERROR)
	{
		if (SUCCEEDED(cd.pUnk->QueryInterface(IID_ICormanLispStatusMessage, 
				(void**)&messager)))
		{
			hr = messager->OpenEditWindow(file, wnd);
			messager->Release();
		}
		cd.pUnk->Release();
	}
	pEnum->Release();
	return hr;
}
Exemplo n.º 5
0
STDMETHODIMP 
CoCormanLisp::LispShutdown(char* text, long numChars)
{
	HRESULT hr = S_OK;
	IEnumConnections* pEnum = 0;
	CONNECTDATA cd = { 0 };
	ICormanLispShutdown* output = 0;

	if (!m_pcpShutdownPointSink)
		return hr;

	if (FAILED(m_pcpShutdownPointSink->EnumConnections(&pEnum)))
		return hr;

	while (pEnum->Next(1, &cd, NULL) == NOERROR)
	{
		if (SUCCEEDED(cd.pUnk->QueryInterface(IID_ICormanLispShutdown, 
				(void**)&output)))
		{
			hr = output->LispShutdown(text, numChars);
			output->Release();
		}
		cd.pUnk->Release();
	}
	pEnum->Release();
	return hr;
}