STDMETHODIMP OrxEvent::CheckEvent(LPCOLESTR Code, IDispatch **pbIDispatch) { ListItem *Current; ESource *Content; HRESULT RetCode=DISP_E_UNKNOWNNAME; int i=0; size_t CodeLen; RetCode = DISP_E_UNKNOWNNAME; if (!Code) { RetCode = E_POINTER; } else { CodeLen = wcslen(Code); } if (!pbIDispatch) { RetCode = E_POINTER; } else { *pbIDispatch = (IDispatch *)NULL; } if (RetCode == DISP_E_UNKNOWNNAME) { while (Current = EventSourceChain->FindItem(i++)) { Content = (ESource *)Current->GetContent(); if (Content->EventType == ESource::ParseProcedure) { if (CodeLen == Content->CodeLen) { if (Content->Code) { if (wcsicmp(Code,Content->Code) == 0) { *pbIDispatch = (IDispatch *)Content; RetCode = S_OK; ((IDispatch*) Content)->AddRef(); break; } } } } } } FPRINTF2(logfile,"OrxEvent::CheckEvent() HRESULT %08x. \n",RetCode); return RetCode; }
OrxEvent::~OrxEvent() { ListItem *Current; ESource *Content; FPRINTF2(logfile,"OrxEvent::~OrxEvent() -- i.e., the destructor. \n"); DisconnectEvents(); Current = EventSourceChain->FindItem(0); while (Current) { Content = (ESource *)Current->GetContent(); if (Content->EventType == ESource::AddScriptlet) { Content->Release(); } Current = EventSourceChain->FindItem(); } delete EventSourceChain; FPRINTF2(logfile,"OrxEvent::~OrxEvent() completed. \n"); }
/****************************************************************************** * * FindDispID * ******************************************************************************/ STDMETHODIMP OrxDispID::FindDispID(OLECHAR *pName, DISPID *pbDispID) { ListItem *CurrItem; PDID CurrDID; int DispID; *pbDispID = (DISPID)0; CurrItem = Chain.FindItem(0); while (CurrItem) { CurrDID = (PDID)CurrItem->GetContent(); if (CurrDID->Name != NULL) if (wcsicmp(pName,CurrDID->Name) == 0) { sscanf(CurrItem->GetName(),"%d",&DispID); *pbDispID = (DISPID)DispID; FPRINTF2(CurrentObj_logfile,"OrxDisp::FindDispID() Found %S, DispID %d\n",pName,DispID); return S_OK; } CurrItem = Chain.FindItem(); } return DISP_E_UNKNOWNNAME; }