USAGEMODE HRESULT Filter_ShowConfigDlg(void* pExistingFilter, const void* psMsgEntry, ETYPE_BUS eType, UINT nHardware, CWnd* pParent) { //Place this code at the beginning of the export function. //Save previous resource handle and switch to current one. HINSTANCE hInst = AfxGetResourceHandle(); AfxSetResourceHandle(FilterDLL.hResource); HRESULT hResult = S_FALSE; switch (eType) { case CAN: { if (pExistingFilter != NULL) { SFILTERAPPLIED_CAN* pAppliedFilterCan = (SFILTERAPPLIED_CAN*)pExistingFilter; SFILTERAPPLIED_CAN sTempObj; sTempObj.bClone(*pAppliedFilterCan); CFilterConfigDlg omDlg(&sTempObj, (SMSGENTRY *)psMsgEntry, nHardware, pParent); if (omDlg.DoModal() == IDOK) { pAppliedFilterCan->bClone(sTempObj); hResult = S_OK; } //delete omDlg; } } break; case LIN: if (pExistingFilter != NULL) { SFILTERAPPLIED_LIN* pAppliedFilterLin = (SFILTERAPPLIED_LIN*)pExistingFilter; SFILTERAPPLIED_LIN sTempObj; sTempObj.bClone(*pAppliedFilterLin); CFilterConfigDlg omDlg(&sTempObj,(ClusterConfig *) psMsgEntry, nHardware, pParent); if (omDlg.DoModal() == IDOK) { pAppliedFilterLin->bClone(sTempObj); hResult = S_OK; } //delete omDlg; } break; default: { } break; } //Place this at the end of the export function. //switch back to previous resource handle. AfxSetResourceHandle(hInst); return hResult; }
HRESULT CMsgContainerCAN::GetFilterScheme(void* pvFilterApplied) { HRESULT hResult = S_FALSE; SFILTERAPPLIED_CAN* psFilterCAN = (SFILTERAPPLIED_CAN*)pvFilterApplied; if (psFilterCAN != NULL) { if (psFilterCAN->bClone(m_sFilterCAN) == TRUE) { hResult = TRUE; } } return hResult; }
HRESULT CMsgContainerCAN::GetFilterScheme(void* pvFilterApplied) { HRESULT hResult = S_FALSE; SFILTERAPPLIED_CAN* psFilterCAN = (SFILTERAPPLIED_CAN*)pvFilterApplied; if (psFilterCAN != nullptr) { // if (psFilterCAN->bClone(m_sFilterCAN) == TRUE) if (psFilterCAN->bClone(m_sFilterCAN) == true) { //hResult = TRUE; hResult = S_OK; } } return hResult; }
static void vPopulateFilterApplied(const SFILTERAPPLIED_CAN* psFilterConfigured, SFILTERAPPLIED_CAN& sFilterApplied, CMainEntryList& SrcList) { if ( psFilterConfigured == nullptr ) { return; } const SMAINENTRY& sMainEntry = SrcList.GetHead(); int nCount = sMainEntry.m_odSelEntryList.GetCount(); SFILTERAPPLIED_CAN sTempAppliedFilter; sTempAppliedFilter.bClone(sFilterApplied); sFilterApplied.vClear(); sFilterApplied.m_psFilters = new SFILTERSET[nCount]; POSITION pos = sMainEntry.m_odSelEntryList.GetHeadPosition(); while (pos) { SSUBENTRY sSubEntry = sMainEntry.m_odSelEntryList.GetNext(pos); const PSFILTERSET psTemp = SFILTERSET::psGetFilterSetPointer(psFilterConfigured->m_psFilters, psFilterConfigured->m_ushTotal, sSubEntry.m_omSubEntryName.GetBuffer(MAX_PATH)); if (psTemp != nullptr) { sFilterApplied.m_psFilters[sFilterApplied.m_ushTotal].bClone(*psTemp); sFilterApplied.m_ushTotal++; } } //restore the enable flag for all filters for(int nAppFilterCnt = 0; nAppFilterCnt < sFilterApplied.m_ushTotal; nAppFilterCnt++) { for(int nTempFilCnt = 0; nTempFilCnt < sTempAppliedFilter.m_ushTotal; nTempFilCnt++ ) { if((&sTempAppliedFilter.m_psFilters[nTempFilCnt]) != nullptr) { if(sFilterApplied.m_psFilters[nAppFilterCnt].m_sFilterName.m_acFilterName == sTempAppliedFilter.m_psFilters[nTempFilCnt].m_sFilterName.m_acFilterName) { ((sFilterApplied.m_psFilters)+ nAppFilterCnt) ->m_bEnabled = ((sTempAppliedFilter.m_psFilters)+ nTempFilCnt) ->m_bEnabled; } } } } }
void CLogObjectCAN::GetFilterInfo(SFILTERAPPLIED_CAN& sFilterInfo) const { sFilterInfo.bClone(m_sFilterApplied); }