//============================================================================== HRESULT CVObject::vSetColor( VARIANT vRGB, long iLogID ){ double * pdData; // We expect 3-long array of doubles if( g_CheckVariantArray( 3, vRGB, &pdData )) { return g_ErrorToHresult( 1 ); } m_fRGB[0] = (float)pdData[0]; m_fRGB[1] = (float)pdData[1]; m_fRGB[2] = (float)pdData[2]; SafeArrayUnaccessData( vRGB.parray ); m_RequestUpdate(iLogID); return S_OK; }
//============================================================================== STDMETHODIMP CVMouse::GetAllEvents(SAFEARRAY ** ppsaMtx){ SAFEARRAY *psaMtx; int * piData; int iSize; * ppsaMtx = NULL; if( g_MakeSafeArray( 3, 3, &psaMtx, &piData ) ){ return g_ErrorToHresult(1); } iSize = sizeof(g_aiMouseEvents); memcpy( piData, g_aiMouseEvents, sizeof(g_aiMouseEvents)); SafeArrayUnaccessData( psaMtx ); * ppsaMtx = psaMtx; return S_OK; }
//============================================================================== STDMETHODIMP CVMouse::GetUpEvents(SAFEARRAY ** ppsaMtx){ SAFEARRAY *psaMtx; int * piData; * ppsaMtx = NULL; if( g_MakeSafeArray( 3, &psaMtx, &piData ) ){ return g_ErrorToHresult(1); } piData[0] = g_aiMouseEvents[MOUSE_LEFT][MOUSE_UP]; piData[1] = g_aiMouseEvents[MOUSE_MIDDLE][MOUSE_UP]; piData[2] = g_aiMouseEvents[MOUSE_RIGHT][MOUSE_UP]; SafeArrayUnaccessData( psaMtx ); * ppsaMtx = psaMtx; return S_OK; }
//============================================================================== STDMETHODIMP CVMain::MoveGroup(long iGroupID, SAFEARRAY * psaXY, long iLogID){ double * pdData; int iObj, nObjects; CVObject *pObj; // We expect 2-long array of doubles if( g_CheckSafeArray( 2, psaXY, &pdData )) { return g_ErrorToHresult( 1 ); } nObjects = g_ptObjectList.GetN_Pointers(); for( iObj = 0; iObj<nObjects; iObj++){ g_ptObjectList.GetPointer( iObj, (void **) &pObj); if(iGroupID) pObj->Move( pdData[0], pdData[1], iGroupID ); else pObj->Move( pdData[0], pdData[1]); } SafeArrayUnaccessData( psaXY ); g_RequestUpdate(iLogID); return S_OK; }