void hb_memvarGetValue( PHB_ITEM pItem, PHB_SYMB pMemvarSymb ) { HB_TRACE( HB_TR_DEBUG, ( "hb_memvarGetValue(%p, %p)", pItem, pMemvarSymb ) ); if( hb_memvarGet( pItem, pMemvarSymb ) == HB_FAILURE ) { /* Generate an error with retry possibility * (user created error handler can create this variable) */ PHB_ITEM pError; pError = hb_errRT_New( ES_ERROR, NULL, EG_NOVAR, 1003, NULL, pMemvarSymb->szName, 0, EF_CANRETRY ); while( hb_errLaunch( pError ) == E_RETRY ) { if( hb_memvarGet( pItem, pMemvarSymb ) == HB_SUCCESS ) break; } hb_errRelease( pError ); } }
static HRESULT STDMETHODCALLTYPE Invoke( IDispatch * lpThis, DISPID dispid, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS * pParams, VARIANT * pVarResult, EXCEPINFO * pExcepInfo, UINT * puArgErr ) { PHB_DYNS pDynSym; PHB_ITEM pAction; HB_USHORT uiClass = 0; HB_SYMBOL_UNUSED( lcid ); HB_SYMBOL_UNUSED( pExcepInfo ); HB_SYMBOL_UNUSED( puArgErr ); if( ! IsEqualIID( riid, HB_ID_REF( IID_NULL ) ) ) return DISP_E_UNKNOWNINTERFACE; pAction = ( ( IHbOleServer * ) lpThis )->pAction; if( ! pAction ) pAction = s_pAction; if( pAction ) { HB_BOOL fResult = HB_FALSE; if( s_pMsgHash ) { if( ( wFlags & DISPATCH_METHOD ) != 0 || ( ( wFlags & DISPATCH_PROPERTYGET ) != 0 && pParams->cArgs == 0 ) || ( ( wFlags & DISPATCH_PROPERTYPUT ) != 0 && pParams->cArgs == 1 ) ) { fResult = hb_oleDispInvoke( NULL, pAction, hb_hashGetKeyAt( s_pMsgHash, ( HB_SIZE ) dispid ), pParams, pVarResult, s_objItemToVariant, uiClass ); } } else if( HB_IS_HASH( pAction ) ) { PHB_ITEM pItem; if( ( ( IHbOleServer * ) lpThis )->fGuids ) { PHB_ITEM pKey = hb_itemPutNL( hb_stackAllocItem(), ( long ) dispid ); pItem = hb_hashGetItemPtr( pAction, pKey, 0 ); hb_stackPop(); } else pItem = hb_hashGetValueAt( pAction, ( HB_SIZE ) dispid ); if( pItem ) { if( HB_IS_EVALITEM( pItem ) ) { if( ( wFlags & DISPATCH_METHOD ) != 0 ) { PHB_SYMB pSym = hb_itemGetSymbol( pItem ); fResult = hb_oleDispInvoke( pSym, pSym ? pAction : pItem, NULL, pParams, pVarResult, s_objItemToVariant, uiClass ); } } else if( ( wFlags & DISPATCH_PROPERTYGET ) != 0 && pParams->cArgs == 0 ) { if( pVarResult ) hb_oleItemToVariantEx( pVarResult, pItem, s_objItemToVariant ); fResult = HB_TRUE; } else if( ( wFlags & DISPATCH_PROPERTYPUT ) != 0 && pParams->cArgs == 1 ) { hb_oleVariantToItemEx( pItem, &pParams->rgvarg[ 0 ], uiClass ); fResult = HB_TRUE; } } } else if( HB_IS_OBJECT( pAction ) ) { pDynSym = hb_dispIdToDynsym( dispid ); if( pDynSym && ( wFlags & DISPATCH_PROPERTYPUT ) != 0 ) { if( pParams->cArgs == 1 ) { char szName[ HB_SYMBOL_NAME_LEN + 1 ]; szName[ 0 ] = '_'; hb_strncpy( szName + 1, hb_dynsymName( pDynSym ), sizeof( szName ) - 2 ); pDynSym = hb_dynsymFindName( szName ); } else pDynSym = NULL; } if( pDynSym && hb_objHasMessage( pAction, pDynSym ) ) { fResult = hb_oleDispInvoke( hb_dynsymSymbol( pDynSym ), pAction, NULL, pParams, pVarResult, s_objItemToVariant, uiClass ); } } if( ! fResult ) return DISP_E_MEMBERNOTFOUND; } else { pDynSym = hb_dispIdToDynsym( dispid ); if( ! pDynSym ) return DISP_E_MEMBERNOTFOUND; if( wFlags & DISPATCH_PROPERTYPUT ) { if( pParams->cArgs == 1 && hb_dynsymIsMemvar( pDynSym ) ) { PHB_ITEM pItem = hb_stackAllocItem(); hb_oleVariantToItemEx( pItem, &pParams->rgvarg[ 0 ], uiClass ); hb_memvarSetValue( hb_dynsymSymbol( pDynSym ), pItem ); hb_stackPop(); return S_OK; } else return DISP_E_MEMBERNOTFOUND; } else if( ( wFlags & DISPATCH_PROPERTYGET ) && pParams->cArgs == 0 && hb_dynsymIsMemvar( pDynSym ) ) { if( pVarResult ) { PHB_ITEM pItem = hb_stackAllocItem(); hb_memvarGet( pItem, hb_dynsymSymbol( pDynSym ) ); hb_oleItemToVariantEx( pVarResult, pItem, s_objItemToVariant ); hb_stackPop(); } return S_OK; } else if( ( wFlags & DISPATCH_METHOD ) == 0 || ! hb_dynsymIsFunction( pDynSym ) ) return DISP_E_MEMBERNOTFOUND; else if( ! hb_oleDispInvoke( hb_dynsymSymbol( pDynSym ), NULL, NULL, pParams, pVarResult, s_objItemToVariant, uiClass ) ) return DISP_E_MEMBERNOTFOUND; } return S_OK; }