bool CAICHRecoveryHashSet::GetPartHashs(CArray<CAICHHash>& rResult) const { ASSERT( m_pOwner ); ASSERT( rResult.IsEmpty() ); rResult.RemoveAll(); if (m_pOwner->IsPartFile() || m_eStatus != AICH_HASHSETCOMPLETE){ ASSERT( false ); return false; } uint32 uPartCount = (uint16)(((uint64)m_pOwner->GetFileSize() + (PARTSIZE - 1)) / PARTSIZE); if (uPartCount <= 1) return true; // No AICH Part Hashs for (uint32 nPart = 0; nPart < uPartCount; nPart++) { uint64 nPartStartPos = (uint64)nPart*PARTSIZE; uint32 nPartSize = (uint32)min(PARTSIZE, (uint64)m_pOwner->GetFileSize()-nPartStartPos); const CAICHHashTree* pPartHashTree = m_pHashTree.FindExistingHash(nPartStartPos, nPartSize); if (pPartHashTree != NULL && pPartHashTree->m_bHashValid) rResult.Add(pPartHashTree->m_Hash); else { rResult.RemoveAll(); ASSERT( false ); return false; } } return true; }
CServer::~CServer(void) { for (int i =0; i < g_LedInfos.GetCount(); i++) { delete g_LedInfos.GetAt(i); } g_LedInfos.RemoveAll(); for (int i =0; i < g_DeviceInfos.GetCount(); i++) { for (int j = 0; j < g_DeviceInfos.GetAt(i)->aGroupInfos.GetCount(); j++) { delete g_DeviceInfos.GetAt(i)->aGroupInfos.GetAt(j); } delete g_DeviceInfos.GetAt(i); } g_DeviceInfos.RemoveAll(); //for (int i =0; i < g_GroupInfos.GetCount(); i++) //{ // delete g_GroupInfos.GetAt(i); //} //g_GroupInfos.RemoveAll(); //CloseSocket(); }
BOOL CDialogInvProcess::OnInitDialog() { CDialog::OnInitDialog(); CArray<int,int> arIds; CStringArray arTickers; // Raw Materials CSQLInvProcess::Get(1, arIds, arTickers); for(int i=0; i<arIds.GetSize(); i++) { int nInd = m_listRaw.AddString(arTickers[i]); m_listRaw.SetItemData(nInd, arIds[i]); } // WIP arIds.RemoveAll(); arTickers.RemoveAll(); CSQLInvProcess::Get(2, arIds, arTickers); for(int i=0; i<arIds.GetSize(); i++) { int nInd = m_listWIP.AddString(arTickers[i]); m_listWIP.SetItemData(nInd, arIds[i]); } // QC arIds.RemoveAll(); arTickers.RemoveAll(); CSQLInvProcess::Get(3, arIds, arTickers); for(int i=0; i<arIds.GetSize(); i++) { int nInd = m_listQC.AddString(arTickers[i]); m_listQC.SetItemData(nInd, arIds[i]); } // Portfolio arIds.RemoveAll(); arTickers.RemoveAll(); CSQLInvProcess::Get(4, arIds, arTickers); for(int i=0; i<arIds.GetSize(); i++) { int nInd = m_listPort.AddString(arTickers[i]); m_listPort.SetItemData(nInd, arIds[i]); } return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
void CInteractionAreaDialog::SetActionText(CMouseAction *pMouseAction, int nEditId) { CString csText; csText.Empty(); UINT nPageOrMarkId = pMouseAction->GetPageMarkId(); AreaActionTypeId nActionTypeId = pMouseAction->GetActionId(); if (nActionTypeId == INTERACTION_JUMP_SPECIFIC_PAGE) { csText = m_pEditorDoc->project.GetPageTitleForId(nPageOrMarkId); } else if (nActionTypeId == INTERACTION_JUMP_TARGET_MARK) { CArray<CStopJumpMark *, CStopJumpMark *> caJumpMarks; CMarkStream *pMarkStream = m_pEditorDoc->project.GetMarkStream(); pMarkStream->GetJumpMarksInRegion(caJumpMarks, 0, m_pEditorDoc->m_displayEndMs); for (int i = 0; i < caJumpMarks.GetSize(); ++i) { if (caJumpMarks[i]->GetId() == nPageOrMarkId) { csText = caJumpMarks[i]->GetLabel(); break; } } caJumpMarks.RemoveAll(); } else if (nActionTypeId == INTERACTION_OPEN_URL || nActionTypeId == INTERACTION_OPEN_FILE) { csText = pMouseAction->GetPath(); } CEdit *pEdit = (CEdit *)GetDlgItem(nEditId); pEdit->SetWindowText(csText); }
void CTobCompiler::Reset() { m_line = 0; m_err.Empty(); m_bin.RemoveAll(); if(m_fsrc) { fclose(m_fsrc); m_fsrc = 0; } if(m_fdst) { fclose(m_fdst); m_fdst = 0; } POSITION p = m_defbin.GetStartPosition(); CString str; CByteArray* bin; while(p) { m_defbin.GetNextAssoc(p, str, bin); delete bin; } m_defbin.RemoveAll(); m_defbin.InitHashTable(251); m_label.RemoveAll(); m_label.InitHashTable(251); for(int i = m_exp.GetSize() - 1; i >= 0; --i) delete m_exp.GetAt(i); m_exp.RemoveAll(); m_change.RemoveAll(); m_change.InitHashTable(251); m_bit_i = 32; m_bit_f = 32; m_maxc = -1; m_maxw = -1; m_maxs = -1; }
// Gets all items of type IT_DRIVE. // void CDirstatDoc::GetDriveItems(CArray<CItem *, CItem *>& drives) { drives.RemoveAll(); CItem *root = GetRootItem(); if(NULL == root) { return; } if(IT_MYCOMPUTER == root->GetType()) { for(int i = 0; i < root->GetChildrenCount(); i++) { CItem *drive = root->GetChild(i); ASSERT(IT_DRIVE == drive->GetType()); drives.Add(drive); } } else if(IT_DRIVE == root->GetType()) { drives.Add(root); } }
void CInteractionAreaDialog::CreateSlidePopup(int nAction, int nButtonId, int nEditId) { CRect rcButton; CWnd *pWndButton = GetDlgItem(nButtonId); pWndButton->GetClientRect(rcButton); pWndButton->ClientToScreen(&rcButton); m_wndMenu.CreatePopupMenu(); CArray<CPage *, CPage *> caPages; m_pEditorDoc->project.GetPages(caPages, 0, m_pEditorDoc->m_docLengthMs); for (int i = 0; i < caPages.GetSize(); ++i) { CString csPageTitle; csPageTitle = caPages[i]->GetTitle(); m_wndMenu.AppendMenu(MF_STRING, i+1, csPageTitle); } BOOL bRet = m_wndMenu.TrackPopupMenu(TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_RETURNCMD, rcButton.left, rcButton.bottom, this); CWnd *pEdit = GetDlgItem(nEditId); // if bRet is zero the menu was cancelled // or an error occured if (bRet != 0) { CString csItem; m_wndMenu.GetMenuString(bRet, csItem, MF_BYCOMMAND); pEdit->SetWindowText(csItem); m_nMarkOrPageId[nAction] = caPages[bRet-1]->GetJumpId(); } caPages.RemoveAll(); m_wndMenu.DestroyMenu(); }
BOOL CSubtitleDlDlg::OnInitDialog() { __super::OnInitDialog(); m_status.Create(WS_CHILD | WS_VISIBLE | CCS_BOTTOM, CRect(0, 0, 0, 0), this, IDC_STATUSBAR); int n, curPos = 0; CArray<int> columnWidth; CString strColumnWidth = AfxGetApp()->GetProfileString(IDS_R_DLG_SUBTITLEDL, IDS_RS_DLG_SUBTITLEDL_COLWIDTH, _T("")); CString token = strColumnWidth.Tokenize(_T(","), curPos); while (!token.IsEmpty()) { if (_stscanf_s(token, L"%i", &n) == 1) { columnWidth.Add(n); token = strColumnWidth.Tokenize(_T(","), curPos); } else { throw 1; } } m_list.SetExtendedStyle(m_list.GetExtendedStyle() | LVS_EX_DOUBLEBUFFER | LVS_EX_FULLROWSELECT | LVS_EX_CHECKBOXES | LVS_EX_LABELTIP); if (columnWidth.GetCount() != 5) { // default sizes columnWidth.RemoveAll(); columnWidth.Add(290); columnWidth.Add(70); columnWidth.Add(50); columnWidth.Add(50); columnWidth.Add(270); } m_list.InsertColumn(COL_FILENAME, ResStr(IDS_SUBDL_DLG_FILENAME_COL), LVCFMT_LEFT, columnWidth[0]); m_list.InsertColumn(COL_LANGUAGE, ResStr(IDS_SUBDL_DLG_LANGUAGE_COL), LVCFMT_CENTER, columnWidth[1]); m_list.InsertColumn(COL_FORMAT, ResStr(IDS_SUBDL_DLG_FORMAT_COL), LVCFMT_CENTER, columnWidth[2]); m_list.InsertColumn(COL_DISC, ResStr(IDS_SUBDL_DLG_DISC_COL), LVCFMT_CENTER, columnWidth[3]); m_list.InsertColumn(COL_TITLES, ResStr(IDS_SUBDL_DLG_TITLES_COL), LVCFMT_LEFT, columnWidth[4]); AddAnchor(IDC_LIST1, TOP_LEFT, BOTTOM_RIGHT); AddAnchor(IDC_CHECK1, BOTTOM_LEFT); AddAnchor(IDOK, BOTTOM_RIGHT); AddAnchor(IDC_STATUSBAR, BOTTOM_LEFT, BOTTOM_RIGHT); const CSize s(420, 200); SetMinTrackSize(s); EnableSaveRestore(IDS_R_DLG_SUBTITLEDL); // start new worker thread to download the list of subtitles m_pTA = DEBUG_NEW THREADSTRUCT; m_pTA->url = m_url; m_pTA->hWND = GetSafeHwnd(); SetStatus(ResStr(IDS_SUBDL_DLG_DOWNLOADING)); AfxBeginThread(RunThread, static_cast<LPVOID>(m_pTA)); return TRUE; }
// 清空属性列表 void CDlgReadInfo::ResetListItems() { m_wndList.DeleteAllItems(); paramList.RemoveAll(); GetDlgItem(IDC_SAVE)->EnableWindow(FALSE); }
BOOL CDialogCompanies::OnInitDialog() { CDialog::OnInitDialog(); LOGFONT lf; memset(&lf, 0, sizeof(lf)); strcpy(lf.lfFaceName, "Arial"); lf.lfHeight = 14; m_Font.CreateFontIndirect(&lf); //m_editTicker.EnableWindow(false); // Get Companies for(int i=0; i<theApp.m_Universe.GetSize(); i++) { CCompany* pCompany = theApp.m_Universe.GetCompany(i); CString sItem; sItem.Format("%s - %s", pCompany->GetTicker(), pCompany->GetName()); int nIndex = m_List.AddString(sItem); m_List.SetItemData(nIndex, (DWORD)pCompany); } CArray<int,int> arIds; CStringArray arNames; int nCount; // Get Industries (really Sectors from DB) nCount = CSQLCompany::GetSectorIdsAndNames(arIds, arNames); for(int i=0; i<nCount; i++) { int nIndex = m_comboIndustry.AddString(arNames[i]); m_comboIndustry.SetItemData(nIndex, arIds[i]); } // Get Sectors (really Industries from DB) arIds.RemoveAll(); arNames.RemoveAll(); nCount = CSQLCompany::GetIndustryIdsAndNames(arIds, arNames); for(int i=0; i<nCount; i++) { int nIndex = m_comboSector.AddString(arNames[i]); m_comboSector.SetItemData(nIndex, arIds[i]); } m_arEditWeights[0] = GetDlgItem(IDC_EDIT_W1); m_arEditWeights[1] = GetDlgItem(IDC_EDIT_W2); m_arEditWeights[2] = GetDlgItem(IDC_EDIT_W3); m_arEditWeights[3] = GetDlgItem(IDC_EDIT_W4); m_arEditWeights[4] = GetDlgItem(IDC_EDIT_W5); m_arEditWeights[5] = GetDlgItem(IDC_EDIT_W6); m_arEditWeights[6] = GetDlgItem(IDC_EDIT_W7); m_arEditWeights[7] = GetDlgItem(IDC_EDIT_W8); m_arEditWeights[8] = GetDlgItem(IDC_EDIT_W9); m_List.SetCurSel(0); SetValues(0); return TRUE; }
int WINAPI FindDupes(const char* szList, HWND hParent) { AFX_MANAGE_STATE(AfxGetAppModuleState()); hStopEvent=CreateEvent(0,0,0,0); sListOfImages.RemoveAll(); sListOfImagesToDelete.RemoveAll(); sListOfImageDibs.RemoveAll(); CString sFiles=szList; sFiles.Replace("\r",""); sFiles+="\n"; while(sFiles.GetLength()>0){ CString sWPTitle=sFiles.SpanExcluding("\n"); if(strlen(sWPTitle)!=strlen(sFiles)){ sFiles=sFiles.Mid(strlen(sWPTitle)+1); }else{ sFiles=""; } if(sWPTitle!="" && FindMini(sFiles,sWPTitle+"\n")==-1){ sListOfImages.Add(sWPTitle); } } if(hCheckThread){ TerminateThread(hCheckThread,0); hCheckThread=0; } DWORD dwID=0; hCheckThread=CreateThread(0,0,CheckImages,0,0,&dwID); DialogBox(theApp.m_hInstance,MAKEINTRESOURCE(IDD_DIALOG),hParent,OptionsDialogProc); bStopCheck=1; csCheck.Lock(); csCheck.Unlock(); WaitForSingleObject(hStopEvent,1000); CloseHandle(hStopEvent); if(hCheckThread){ TerminateThread(hCheckThread,0); } CloseHandle(hCheckThread); hCheckThread=0; hStopEvent=0; for(int i=0;i<sListOfImageDibs.GetSize();i++){ if(sListOfImageDibs[i]){ delete sListOfImageDibs[i]; } } sPathInLeft=""; sPathInRight=""; if(btLeft){ _bmpX()->ReleaseBmp(btLeft); btLeft=0; } if(btRight){ _bmpX()->ReleaseBmp(btRight); btRight=0; } return lDeletedFiles; }
void DcapWellboreZoneDesigGridCell::GetSelectionList(CStringArray& aText, CArray<bool,bool>& aEnable) { aText.RemoveAll(); aEnable.RemoveAll(); for (int i = 0; i < DataCaptureGridCtrl::wellboreZoneStrings.Size(); i++) { aText.Add(DataCaptureGridCtrl::wellboreZoneStrings[i]); aEnable.Add(true); } }
void CGraph::LoadDxfFile(CString dxfFileString) { g_ptrGraphArray.RemoveAll(); DxfReading(dxfFileString); GraphInit(); PreviewDxfGraph(); }
void SequenceDesigGridCell::GetSelectionList(CStringArray& aText, CArray<bool,bool>& aEnable) { aText.RemoveAll(); aEnable.RemoveAll(); for (int i = 0; i < TestZoneCurveGridCtrl::sequenceDesigStrings.Size(); i++) { aText.Add(TestZoneCurveGridCtrl::sequenceDesigStrings[i]); aEnable.Add(true); } }
u32 CHookFunction_i::GetExportFunctionInfo(CArray<EXPORT_FUN_INFO, EXPORT_FUN_INFO&>& InfoArray, const char* pszDllFile) { if(!pszDllFile) { return 0; } PLOADED_IMAGE pImage = ::ImageLoad((char*)pszDllFile, NULL); if(!pImage) { return 0; } DWORD dwBase = (DWORD)pImage->MappedAddress; PIMAGE_SECTION_HEADER pSections = (PIMAGE_SECTION_HEADER)((DWORD)pImage->FileHeader + sizeof(IMAGE_NT_HEADERS)); PIMAGE_EXPORT_DIRECTORY pExportDir = (PIMAGE_EXPORT_DIRECTORY)(RVA2RawAdr(pSections, pImage->FileHeader->OptionalHeader.DataDirectory[0].VirtualAddress) + dwBase); InfoArray.RemoveAll(); EXPORT_FUN_INFO info; DWORD* pFunOffsetAdr = (DWORD*)(RVA2RawAdr(pSections, pExportDir->AddressOfFunctions) + dwBase); for(DWORD i = 0; i < pExportDir->NumberOfFunctions; i++) { info.dwOffset = 0; info.strFunName = ""; info.dwOrdinal = 0; info.dwOffset = *(pFunOffsetAdr + i); info.dwOrdinal = i + 1; InfoArray.Add(info); } DWORD* pFunNamesAdr = (DWORD*)(RVA2RawAdr(pSections, pExportDir->AddressOfNames) + dwBase); WORD* pFunNamesOrdinalAdr = (WORD*)(RVA2RawAdr(pSections, pExportDir->AddressOfNameOrdinals) + dwBase); char* pName = NULL; for(i = 0; i < pExportDir->NumberOfNames; i++) { pName = (char*)(RVA2RawAdr(pSections, *(pFunNamesAdr+i)) + dwBase); int idx = *(pFunNamesOrdinalAdr+i); if(idx < InfoArray.GetSize()) { EXPORT_FUN_INFO& tmpInfo = InfoArray.ElementAt(idx); tmpInfo.strFunName = pName; } } ImageUnload(pImage); return InfoArray.GetSize(); }
BOOL CCollegeTimeTableView::OnPreparePrinting(CPrintInfo* pInfo) {pInfo->SetMinPage(1); CString temp,temp2; CStringArray arr; arr.SetSize(20); //// for parallel lecture splitting in diff strings int height,maxheight; int LineCounter=0,PageIndex=0; PageArray.RemoveAll(); ////// Reset Page Description Array CPage tempage; PageArray.Add(tempage); BOOL bLastEmpty=FALSE; for(int i=1;i<ROWS;i++) ////// Preapre Page Description {maxheight=1; temp=m_master.GetItemText(i,0); if(temp.IsEmpty()){ if(i+1<ROWS) { temp2=m_master.GetItemText(i+1,0); if(temp2[0]>='0' && temp2[0]<='9') continue;///no blank line before time cell ///since onprint() will create one } if(bLastEmpty) continue; /// keep atmost one empty row if((LineCounter+1)<LinesPerPage) {LineCounter++; PageArray[PageIndex].Line.Add(i); bLastEmpty=TRUE; continue; } else {PageIndex++; PageArray.Add(tempage); LineCounter=0; continue; } } bLastEmpty=FALSE; GetParallelLectureList(temp,arr);// Get Parallel lectures in CStringarray arr height=arr.GetSize(); if(height<1) height=1; if(height>maxheight) maxheight=height; ///max cell height,>1 for parallel lectures if((LineCounter+maxheight)<LinesPerPage) {LineCounter+=maxheight; //include lines PageArray[PageIndex].Line.Add(i); continue; ///go for more lines } PageIndex++; /// Page Full, go for next page PageArray.Add(tempage);///Create Empty Page Struct LineCounter=maxheight; /// PageArray[PageIndex].Line.Add(i); } pInfo->SetMaxPage(PageIndex+1); return DoPreparePrinting(pInfo); }
/******************************************************************************* Function Name : vGetSelectedIndeces Input(s) : omIndexList - List of indeces Output : - Functionality : To get all selected indeces from the list control Member of : CMsgReplayWnd Author(s) : Raja N Date Created : 16.7.2005 Modifications : *******************************************************************************/ void CMsgReplayWnd::vGetSelectedIndeces( CArray<int,int>& omIndexList ) { // Remove all elements from the array omIndexList.RemoveAll(); // Get the position first POSITION pos = m_omMessageList.GetFirstSelectedItemPosition(); // Get the list while( pos != nullptr ) { int nIndex = m_omMessageList.GetNextSelectedItem( pos ); omIndexList.Add( nIndex ); } }
void CurveDesigGridCell::GetSelectionList(CStringArray& aText, CArray<bool,bool>& aEnable) { aText.RemoveAll(); aEnable.RemoveAll(); for (int i = 0; i < TestZoneCurveGridCtrl::curveFileDesigStrings.Size(); i++) { aText.Add(TestZoneCurveGridCtrl::curveFileDesigStrings[i]); aEnable.Add(true); } if (TestZoneCurveGridCtrl::curveFileDesigStrings.IsEmpty()) { aText.Add("no file set"); aEnable.Add(false); } }
void CDirstatApp::GetAvailableResourceDllLangids(CArray<LANGID, LANGID>& arr) { arr.RemoveAll(); CFileFind finder; BOOL b= finder.FindFile(GetAppFolder() + _T("\\wdsr*.dll")); while (b) { b= finder.FindNextFile(); if (finder.IsDirectory()) continue; LANGID langid; if (ScanResourceDllName(finder.GetFileName(), langid) && IsCorrectResourceDll(finder.GetFilePath())) arr.Add(langid); } }
HRESULT ProfileUtils::GetNewProfileID(__int64 &iNewProfileID) { HRESULT hr = S_OK; // REVIEW UK: // Is it really necessary to read and delete all profiles for any method call? // "Magic number" 3000; should be a constant/documented // arProfile should not be an array but a map; using the id as key // -> then the bIDAlreadyUsed loop would not be necessary // Variable name bCorrectID: better bUnusedIdFound // Variable name iNewProfileID: it is really a long: lNewProfileId CArray<ProfileInfo *, ProfileInfo *> arProfile; hr = ReadCustomProfiles(arProfile); bool bCorrectID = false; while (SUCCEEDED(hr) && !bCorrectID) { iNewProfileID = 0; if (SUCCEEDED(hr)) { while (iNewProfileID >= 0 && iNewProfileID < 3000 && SUCCEEDED(hr)) { iNewProfileID = LMisc::GetRandomValue(); if (iNewProfileID == 0) hr = E_FAIL; } } bool bIDAlreadyUsed = false; if (SUCCEEDED(hr)) { for (int i = 0; i < arProfile.GetSize() && !bIDAlreadyUsed; ++i) { if (arProfile[i]->GetID() == iNewProfileID) bIDAlreadyUsed = true; } } if (!bIDAlreadyUsed) bCorrectID = true; } for (int i = 0; i < arProfile.GetSize(); ++i) if (arProfile[i] != NULL) delete arProfile[i]; arProfile.RemoveAll(); return hr; }
HRESULT ProfileUtils::AddProfileToRecentList(int iDefaultProfileID) { HRESULT hr = S_OK; CString csLastActivated; hr = ProfileUtils::GetProfileNameFromID(iDefaultProfileID, csLastActivated, false); __int64 lCustomProfileID = 0; if (SUCCEEDED(hr)) { if (csLastActivated == _T("Custom")) hr = ProfileUtils::GetActiveProfileID(lCustomProfileID); } CArray<RegistryProfileInfo *, RegistryProfileInfo *> arRecentProfile; if (SUCCEEDED(hr)) hr = GetRecentProfiles(arRecentProfile); if (SUCCEEDED(hr)) { bool bFound = false; for (int i = 0; i < arRecentProfile.GetSize(); ++i) { if (arRecentProfile[i] != NULL && arRecentProfile[i]->GetName() == csLastActivated && arRecentProfile[i]->GetCustomProfileID() == lCustomProfileID) { arRecentProfile[i]->UpdateLastActivatedTime(); bFound = true; } } if (!bFound) { RegistryProfileInfo *pNewProfile = new RegistryProfileInfo(csLastActivated, lCustomProfileID); pNewProfile->UpdateLastActivatedTime(); arRecentProfile.Add(pNewProfile); } } if (SUCCEEDED(hr)) hr = SetRecentProfiles(arRecentProfile); for (int i = 0; i < arRecentProfile.GetSize(); ++i) if (arRecentProfile[i] != NULL) delete arRecentProfile[i]; arRecentProfile.RemoveAll(); return hr; }
HRESULT ProfileUtils::SetProfilePublished(int iDefaultProfileID, CString csDocTitle) { HRESULT hr = S_OK; CString csLastActivated; hr = ProfileUtils::GetProfileNameFromID(iDefaultProfileID, csLastActivated, false); CArray<RegistryProfileInfo *, RegistryProfileInfo *> arRecentProfile; if (SUCCEEDED(hr)) hr = GetRecentProfiles(arRecentProfile); if (SUCCEEDED(hr)) { bool bFound = false; for (int i = 0; i < arRecentProfile.GetSize(); ++i) { if (arRecentProfile[i]->GetName() == csLastActivated) { arRecentProfile[i]->ResetNotUsedCount(); arRecentProfile[i]->UpdatePublishingTime(); arRecentProfile[i]->SetLastPublishedDoc(csDocTitle); bFound = true; } else { arRecentProfile[i]->IncrementNotUsedCount(); } } if (!bFound) { __int64 lCustomProfileID = 0; if (csLastActivated != _T("Custom")) ProfileUtils::GetActiveProfileID(lCustomProfileID); RegistryProfileInfo *pNewProfile = new RegistryProfileInfo(csLastActivated, lCustomProfileID); pNewProfile->UpdatePublishingTime(); pNewProfile->SetLastPublishedDoc(csDocTitle); arRecentProfile.Add(pNewProfile); } } if (SUCCEEDED(hr)) hr = SetRecentProfiles(arRecentProfile); for (int i = 0; i < arRecentProfile.GetSize(); ++i) if (arRecentProfile[i] != NULL) delete arRecentProfile[i]; arRecentProfile.RemoveAll(); return hr; }
void CGraph::GraphInit(void) { #ifdef USE_STL_DEQUE m_GraphDataInfoStructDeque.resize(0); m_GraphDataInfoStructDeque.resize(CNC_GRAPH_MAX_POINT_NUM); #else memset(m_pGraphDataInfoStruct, 0, sizeof(GraphDataInfoStruct) * CNC_GRAPH_MAX_POINT_NUM); #endif m_iGraphPointCurrentNum = 0; m_GraphPointMinX = INT_MAX; m_GraphPointMinY = INT_MAX; m_GraphPointMaxX = INT_MIN; m_GraphPointMaxY = INT_MIN; g_fRate = 1.0; if(g_ptrGraphArray.GetSize() != 0) g_ptrGraphArray.RemoveAll(); if(m_hGraphWnd != NULL) { CRect rt; GetWindowRect(m_hGraphWnd, &rt); m_cxStaticWidth = rt.Width(); m_cyStaticHeight = rt.Height(); m_cxExcludeFrameStaticWidth = m_cxStaticWidth - FRAME_EDAGE_OFFSET * 2; m_cyExcludeFrameStaticHeight = m_cyStaticHeight - FRAME_EDAGE_OFFSET * 2; /*m_pNullBrush = CBrush::FromHandle((HBRUSH)GetStockObject(NULL_BRUSH)); m_Pen.CreatePen(PS_SOLID, 1, RGB(255, 0, 0));*/ m_hBlackBrush = ::CreateSolidBrush(RGB(0, 0, 0)); m_hDrawPointPen = ::CreatePen(PS_SOLID, 1, RGB(0, 255, 0)); m_hMemDC = ::CreateCompatibleDC(m_hGraphDC); m_hBitmap = ::CreateCompatibleBitmap(m_hGraphDC, m_cxStaticWidth, m_cyStaticHeight); m_hFramePen = ::CreatePen(PS_SOLID, 1, RGB(0, 0, 255)); m_hCurrentToolPointPen = ::CreatePen(PS_SOLID, 1, RGB(255, 0, 0)); m_hCurrentToolPointBrush = ::CreateSolidBrush(RGB(255, 0, 0)); } }
void CurveFOGridCell::GetSelectionList(CStringArray& aText, CArray<bool,bool>& aEnable) { aText.RemoveAll(); aEnable.RemoveAll(); if (TestZoneCurveGridCtrl::curveFOOK) { for (int i = 0; i < TestZoneCurveGridCtrl::curveFOStrings.Size(); i++) { aText.Add(TestZoneCurveGridCtrl::curveFOStrings[i]); aEnable.Add(true); } } else { aText.Add("no crv obj"); aEnable.Add(false); } }
HRESULT ProfileUtils::ReadCustomProfiles(CArray<ProfileInfo *, ProfileInfo *> &aProfileInformation) { HRESULT hr = S_OK; CArray<ProfileInfo *, ProfileInfo *> aAllProfileInformation; hr = ReadProfiles(aAllProfileInformation); if (SUCCEEDED(hr)) { for (int i = 0; i < aAllProfileInformation.GetSize(); ++i) { // default profiles have IDs betweeen 0 and 3000 if (aAllProfileInformation[i]->GetID() > 0 && aAllProfileInformation[i]->GetID() < DEFAULT_PROFILE_MAX) delete aAllProfileInformation[i]; else aProfileInformation.Add(aAllProfileInformation[i]); } aAllProfileInformation.RemoveAll(); } return hr; }
void CFileSelectList::Export(CArray<TRANSFER_ITEMSEL_STRUCT>& aryItem,CImageList& ImageList) { //导出图标 //while(ImageList.GetImageCount()>0) // ImageList.Remove(0); //for(int i = 0;i < m_ImageListNormal.GetImageCount();++i) //{ // HICON hIcon = m_ImageListNormal.ExtractIcon(i); // if(hIcon) // { // ImageList.Add(hIcon); // DestroyIcon(hIcon); // } //} aryItem.RemoveAll(); int iCount = GetItemCount(); for(int i = 0;i < iCount; ++i) { CString strPath; TCHAR tcBuf[MAX_PATH]; LVITEM lvit = {0}; lvit.iItem = i; lvit.iSubItem = 0; lvit.pszText = tcBuf; lvit.cchTextMax = sizeof(tcBuf); lvit.mask = LVIF_TEXT|LVIF_IMAGE|LVIF_PARAM; GetItem(&lvit); TRANSFER_ITEMSEL_STRUCT tsi={0}; tsi.strItemName = lvit.pszText; tsi.strItemPath = ((ItemDataType*)lvit.lParam)->strItemUrl;//GetItemText(i,1) + tsi.strItemName; tsi.iItemImg = lvit.iImage; aryItem.Add(tsi); } }
GRAPHSTUDIO_NAMESPACE_START // cf stdafx.h for explanation BOOL GetLocalAddresses(CArray<CString> &adrlist) { char hostname[1024]; if (gethostname(hostname, sizeof(hostname)) == SOCKET_ERROR) return FALSE; adrlist.RemoveAll(); struct hostent *he = gethostbyname(hostname); if (!he) return FALSE; for (int i=0; he->h_addr_list[i] != NULL; i++) { struct in_addr addr; memcpy(&addr, he->h_addr_list[i], sizeof(addr)); CString addr_str; addr_str = inet_ntoa(addr); adrlist.Add(addr_str); } return TRUE; }
//----------------------------------------------------------------------------- // /// DESCRIPTION: /// This method retrieves a list of string corresponding to a section name /// /// RETURNS: /// 0 by default /// /// REQUIREMENT ID: NONE //----------------------------------------------------------------------------- DWORD CIniFile::GetIniProfileSection(QString SecName,CArray<QString,QString>& ReturnedStringArray) { QString current,key; bool sectionfnd=false; int fnd; ReturnedStringArray.RemoveAll(); for (int line=0;line<m_StringTable.GetSize();line++) { current=m_StringTable[line]; current=current.stripWhiteSpace(); if (current.length()) { // looks if section SecName has been found in the ini file if ((current[0]=='[') && (current.at(current.length()-1)==']')) { if (sectionfnd) break; if (current.compare("["+SecName+"]")==0) sectionfnd=true; } else { //if section name has been found, retrieves a list of string //coresponding to the section name if (sectionfnd) { fnd=current.find("="); if (fnd!=-1) { key=current.left(fnd); ReturnedStringArray.Add(key); } } } } } return 0; }
ProfileInfo *ProfileUtils::GetProfileWithID(__int64 iProfileID) { HRESULT hr = S_OK; ProfileInfo *pProfileInfo = NULL; CArray<ProfileInfo *, ProfileInfo *> arProfile; hr = ReadCustomProfiles(arProfile); if (SUCCEEDED(hr)) { for (int i = 0; i < arProfile.GetSize() && pProfileInfo == NULL; ++i) { if (arProfile[i]->GetID() == iProfileID) { pProfileInfo = new ProfileInfo(arProfile[i]); break; } } } for (int i = 0; i < arProfile.GetSize(); ++i) if (arProfile[i] != NULL) delete arProfile[i]; arProfile.RemoveAll(); return pProfileInfo; }
BOOL CSubtitleUpDlg::OnInitDialog() { __super::OnInitDialog(); m_progress.SetParent(&m_status); m_progress.UpdateWindow(); int n = 0, curPos = 0; CArray<int> columnWidth; CString strColumnWidth(AfxGetApp()->GetProfileString(IDS_R_DLG_SUBTITLEUP, IDS_RS_DLG_SUBTITLEUP_COLWIDTH)); CString token(strColumnWidth.Tokenize(_T(","), curPos)); while (!token.IsEmpty()) { if (_stscanf_s(token, L"%d", &n) == 1) { columnWidth.Add(n); token = strColumnWidth.Tokenize(_T(","), curPos); } else { throw 1; } } m_list.SetExtendedStyle(m_list.GetExtendedStyle() | LVS_EX_DOUBLEBUFFER | LVS_EX_FULLROWSELECT | LVS_EX_CHECKBOXES | LVS_EX_LABELTIP); m_list.SetImageList(&m_pMainFrame->m_pSubtitlesProviders->GetImageList(), LVSIL_SMALL); if (columnWidth.GetCount() != COL_TOTAL_COLUMNS) { // default sizes columnWidth.RemoveAll(); columnWidth.Add(120); columnWidth.Add(75); columnWidth.Add(250); } m_list.InsertColumn(COL_PROVIDER, ResStr(IDS_SUBDL_DLG_PROVIDER_COL), LVCFMT_LEFT, columnWidth[COL_PROVIDER]); m_list.InsertColumn(COL_USERNAME, ResStr(IDS_SUBUL_DLG_USERNAME_COL), LVCFMT_LEFT, columnWidth[COL_USERNAME]); m_list.InsertColumn(COL_STATUS, ResStr(IDS_SUBUL_DLG_STATUS_COL), LVCFMT_LEFT, columnWidth[COL_STATUS]); m_list.SetRedraw(FALSE); m_list.DeleteAllItems(); int i = 0; for (const auto& iter : m_pMainFrame->m_pSubtitlesProviders->Providers()) { if (iter->Flags(SPF_UPLOAD)) { int iItem = m_list.InsertItem((int)i++, CString(iter->Name().c_str()), iter->GetIconIndex()); m_list.SetItemText(iItem, COL_USERNAME, UTF8To16(iter->UserName().c_str())); m_list.SetItemText(iItem, COL_STATUS, ResStr(IDS_SUBUL_DLG_STATUS_READY)); m_list.SetCheck(iItem, iter->Enabled(SPF_UPLOAD)); m_list.SetItemData(iItem, (DWORD_PTR)(iter.get())); } } m_list.SetRedraw(TRUE); m_list.Invalidate(); m_list.UpdateWindow(); UpdateData(FALSE); AddAnchor(IDC_LIST1, TOP_LEFT, BOTTOM_RIGHT); AddAnchor(IDC_BUTTON1, BOTTOM_RIGHT); AddAnchor(IDC_BUTTON2, BOTTOM_RIGHT); AddAnchor(IDOK, BOTTOM_RIGHT); AddAnchor(IDC_STATUSBAR, BOTTOM_LEFT, BOTTOM_RIGHT); const CSize s(500, 250); SetMinTrackSize(s); EnableSaveRestore(IDS_R_DLG_SUBTITLEUP, TRUE); return TRUE; }