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); }
void CMServerManagerView::OnTabColor() { UpdateData(); CArray<COLORREF, COLORREF> arColors; arColors.Add(RGB (121, 210, 231)); arColors.Add(RGB (190, 218, 153)); arColors.Add(RGB (255, 170, 100)); m_mfcTab.EnableAutoColor(TRUE); m_mfcTab.SetAutoColors(arColors); }
////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// tcCanDll::tcCanDll(tcParamCan* pParamCan) { m_pParam = NULL; // Create Can session int CardNumber = 0; CString Err; CString FullError; CArray<CString,CString> CanCardList; // Search Can card if (strcmp(pParamCan->CanCardName,cCanCardAUTOMATIC) == 0) { char Buffer[MAX_PATH]; for(U8 i=0;i<GetCanCardListAvailable(0,NULL);i++) { GetCanCardListAvailable(i,Buffer); // Remove ADLink card in Automatic research because it open DialogBox if (strncmp(pParamCan->CanCardName,cCanCardADLINK,sizeof(cCanCardADLINK)-1)) { CanCardList.Add(Buffer); } } } else { CanCardList.Add(pParamCan->CanCardName); } while((CardNumber < CanCardList.GetSize()) && (m_pParam == NULL)) { strcpy(pParamCan->CanCardName,CanCardList[CardNumber]); if ((strcmp(pParamCan->CanCardName,cCanCardVIRTUAL) != 0) // Pass cCanCardVIRTUAL if not first ||(CardNumber == 0)) { if (strcmp(pParamCan->CanCardName,cCanCardAUTOMATIC) != 0) // Pass cCanCardAUTOMATIC { m_pParam = GetCanCard(pParamCan,Err); if (m_pParam == NULL) { FullError += Err; FullError += '\n'; } } } CardNumber++; } if((pParamCan->FCallBackMsg != NULL) && (m_pParam == NULL)) // Can card not found { pParamCan->FCallBackMsg(cErrorMsg,FullError,pParamCan->ParamCallBackMsg); } }
void CSkyODL::OnDrawFace( Gdiplus::Graphics& gcDrawer, float fScale ) { CBaseODL::OnDrawFace(gcDrawer, fScale); Gdiplus::Pen Dot( m_clDotColor, static_cast<Gdiplus::REAL>(1.0 / fScale)); CArray<Gdiplus::Point> st; CArray<BYTE> stBytes; for (auto& curItem : m_arrTopPoint) { Gdiplus::Point pt; pt.X = static_cast<INT>(curItem.X()); pt.Y = static_cast<INT>(-curItem.Z()); st.Add(pt); } if(st.GetSize()<=0) { return; } Gdiplus::Pen pen( m_clPenColor, static_cast<Gdiplus::REAL>(1.0 / fScale)); pen.SetDashStyle(Gdiplus::DashStyleSolid); Gdiplus::HatchBrush brush( Gdiplus::HatchStyle(Gdiplus::HatchStyle::HatchStyleCross ), m_clPenColor, Gdiplus::Color(0,255,255,255) ); //画皮肤 gcDrawer.FillPolygon(&brush, st.GetData(), st.GetSize(), Gdiplus::FillMode::FillModeAlternate); gcDrawer.DrawLines(&pen, st.GetData(), st.GetSize()); }
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); } }
int BusInfoQueryRight(CArray<rowItem, rowItem> &rest) { int index = 0; for(index = 0; index<(sizeof(Table)/sizeof(Table[0])); index++){ if(Table[index].name.Compare(_T("bus")) == 0) break; } struct query query; query.from = _T("bus"); query.selectedItemCount = Table[index].itemKeyCount + Table[index].itemOthersCount; for(int i = 0; i<query.selectedItemCount; i++){ query.SI[i].name = Table[index].fieldValue[i].fieldName; query.SI[i].chineseName = Table[index].fieldValue[i].chineseName; } query.whereItemCount = 0; query.otherTerm = _T(""); Query(&query, rest); if(rest.GetCount() == 0){ rowItem temp; temp.fieldCount = Table[index].itemKeyCount + Table[index].itemOthersCount; for(int i = 0; i<temp.fieldCount; i++){ temp.CI[i].chineseName = Table[index].fieldValue[i].chineseName; temp.CI[i].name = Table[index].fieldValue[i].fieldName; temp.CI[i].valueType = Table[index].fieldValue[i].fieldType; } rest.Add(temp); } return TRUE; }
void MusicUtils::ScanFile(CString Dir,CArray<CString,CString&>& filearray,CString filetype) { CFileFind finder; CString Add=L"\\*"; CString DirSpec=Dir+Add; //补全要遍历的文件夹的目录 BOOL bWorking = finder.FindFile(DirSpec); while (bWorking) { bWorking = finder.FindNextFile(); if(!finder.IsDots()) //扫描到的不是节点 { if(finder.IsDirectory()) //扫描到的是文件夹 { CString strDirectory = finder.GetFilePath(); ScanFile(strDirectory,filearray,filetype); //递归调用ScanFile() } else //扫描到的是文件 { CString strFile = finder.GetFilePath(); // 得到文件的全路径 CString ext = GetFileTitleFromFileName(strFile).MakeLower(); if (ext==CString("bmp")) { filearray.Add(strFile); } //进行一系列自定义操作 } } } finder.Close(); }
void CDebuggerView::OnDbTogglebreakpoint() { int pos = m_editor.SendEditor(SCI_GETCURRENTPOS); int lineNumber = m_editor.SendEditor(SCI_LINEFROMPOSITION, pos); // Is there a breakpoint currently here? int breakpointIndex = FindBreakpoint(m_currentFileName, lineNumber); if (breakpointIndex == -1) { // No, add it. m_editor.SendEditor(SCI_MARKERDEFINE, MARKER_BREAKPOINT, SC_MARK_CIRCLE); m_editor.SendEditor(SCI_MARKERSETFORE, MARKER_BREAKPOINT, RGB(0x00, 0x00, 0)); m_editor.SendEditor(SCI_MARKERSETBACK, MARKER_BREAKPOINT, RGB(0xff, 0x00, 0x00)); m_editor.SendEditor(SCI_MARKERADD, lineNumber, MARKER_BREAKPOINT); // Add the breakpoint. BreakpointInfo info; info.m_fileName = m_currentFileName; info.m_lineNumber = lineNumber; m_breakpointInfo.Add(info); } else { // Remove the breakpoint. m_editor.SendEditor(SCI_MARKERDELETE, lineNumber, MARKER_BREAKPOINT); m_breakpointInfo.RemoveAt(breakpointIndex); } CString command; command.Format(_T("DebugSetBreakpoint('%s',%d,%s)"), m_currentFileName, lineNumber, (breakpointIndex == -1) ? _T("true") : _T("false")); theApp.GetNetworkClient().SendCommand(command); }
void CTemplateParserApp::AddMissingFile(CString csFile) { // unfortunately doesn't work: as FileExists() doesn't work char szFileName[MAX_PATH*2]; strcpy (szFileName, (LPCTSTR)csFile); CArray<CString, CString> nonExistant; char *szSuffix = strrchr(szFileName, '\\'); while(NULL != szSuffix && !FileExists(szFileName)) { // there must be at least one \ remaining in szFile (i.e. c:\) CString csNono(szFileName); // TODO: Wie geht denn das hier mit der Speicherverwaltung?? // Diese Variable ist doch nur auf dem Stack. nonExistant.Add(csNono); szSuffix[0] = '\0'; szSuffix = strrchr(szFileName, '\\'); } if (nonExistant.GetSize() > 0) { for (int i=nonExistant.GetSize()-1; i>=0; --i) { m_writtenFiles.Add(nonExistant[i]); // it is important that them are added in reverse order // so that created directories are before the contained files } } }
int CCaptureVideo::EnumDevices(CArray<CString, CString>& arList) { int nCount = 0; //枚举视频扑捉设备 ICreateDevEnum *pCreateDevEnum; HRESULT hr = CoCreateInstance(CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC_SERVER,IID_ICreateDevEnum, (void**)&pCreateDevEnum); if (hr != NOERROR)return -1; CComPtr<IEnumMoniker> pEm; hr = pCreateDevEnum->CreateClassEnumerator(CLSID_VideoInputDeviceCategory,&pEm, 0); if (hr != NOERROR)return -1; pEm->Reset(); ULONG cFetched; IMoniker *pM; while(hr = pEm->Next(1, &pM, &cFetched), hr==S_OK) { IPropertyBag *pBag; hr = pM->BindToStorage(0, 0, IID_IPropertyBag, (void **)&pBag); if(SUCCEEDED(hr)) { VARIANT var; var.vt = VT_BSTR; hr = pBag->Read(L"FriendlyName", &var, NULL); if (hr == NOERROR) { char szStr[2048]; nCount++; WideCharToMultiByte(CP_ACP,0,var.bstrVal, -1, szStr, 2048, NULL, NULL); arList.Add( CString(szStr) ); SysFreeString(var.bstrVal); pM->AddRef(); } pBag->Release(); } pM->Release(); } return nCount; }
void SeriesValuesDialog::OnLvnKeydownList2(NMHDR *pNMHDR, LRESULT *pResult) { LPNMLVKEYDOWN pLVKeyDow = reinterpret_cast<LPNMLVKEYDOWN>(pNMHDR); int i,n; POSITION pos; CArray<int,const int&> arr; CString temp; CString T,T1; void *x; TChartSeries *graph; switch(pLVKeyDow->wVKey) { case VK_DELETE: if((x=Series->GainAcsess(WRITE))!=NULL) { SeriesProtector guard(x); TSeriesArray& series(guard); graph=series[graph_num]; n=graph->GetSize(); pos=ListBox2.GetFirstSelectedItemPosition(); while(pos) arr.Add(ListBox2.GetNextSelectedItem(pos)); graph->SetParentUpdateStatus(UPD_OFF); for(i=0;i<arr.GetSize();i++) { n=arr[i]; graph->RemoveAt(n-i); ListBox2.DeleteItem(n-i); } graph->SetParentUpdateStatus(UPD_ON); } break; } *pResult = 0; }
// Tao da giac deu voi // iIdentity > 2: nhan dang da giac deu, = 5: ngu giac deu, = 6: luc giac deu ... // dAlpha: diem bat dau cua da giac deu co goc la dAlpha // (x,y) tam cua da giac deu // iRadius: ban kinh // iColor: mau cua duong bien da giac deu void _Polygon::CreateEquilateralPolygon(int iIdentity, double dAlpha, int x, int y, int iRadius, int iColor) { CString _strError(""); if (iIdentity <= 2) { _strError = "_Polygon::CreateEquilateralPolygon() --> iIdentity: Khong phai da giac"; iIdentity = 3; } CArray<POINT> arrTemp; POINT temp; double dAngle = 2*PI / iIdentity; // goc quay // Tao cac dinh cua da giac deu for (int i = 0; i < iIdentity; ++i) { temp.x = iRadius * cos(dAlpha + dAngle * i) + x; temp.y = iRadius * sin(dAlpha + dAngle * i) + y; arrTemp.Add(temp); } CreatePolygon(arrTemp, iColor); strError += _strError; // Gan loi }
void SeriesListCtrl::OnDeleteSeries() { POSITION pos=GetFirstSelectedItemPosition(); bool upd=false; void *x; if(pos) { CArray<int,const int&> ToDel; int i; CString temp; while(pos) ToDel.Add(GetItemData(GetNextSelectedItem(pos))); qsort(ToDel.GetData(),ToDel.GetSize(),sizeof(int),compfunc); for(i=0;i<ToDel.GetSize();i++) { int n=ToDel[i]; temp.Format("Series %s contains %d points. Remove it?",Items[n].Name,Items[n].Size); if(AfxMessageBox(temp,MB_YESNO)==IDNO) ToDel[i]=-1; } if((x=Series->GainAcsess(WRITE))!=0) { upd=true; SeriesProtector Protector(x); TSeriesArray& Series(Protector); { for(i=0;i<ToDel.GetSize();i++) if(ToDel[i]>=0) Series.DeleteItem(ToDel[i]); } } if(upd) UpdateSeriesList(); } }
void CRegistry::DeleteKey(HKEY hParent, LPCTSTR pszKey) { HKEY hKey; if ( RegOpenKeyEx( hParent, pszKey, 0, KEY_ALL_ACCESS, &hKey ) ) return; CArray< CString > pList; for ( DWORD nIndex = 0 ; ; nIndex++ ) { DWORD dwName = 64; // Input parameter in TCHARs TCHAR szName[64]; LRESULT lResult = RegEnumKeyEx( hKey, nIndex, szName, &dwName, NULL, NULL, 0, NULL ); if ( lResult != ERROR_SUCCESS ) break; szName[ dwName ] = 0; pList.Add( szName ); DeleteKey( hKey, szName ); } for ( int nItem = pList.GetSize() - 1 ; nItem >= 0 ; nItem-- ) { RegDeleteKey( hKey, pList.GetAt( nItem ) ); } if ( lstrlen( pszKey ) > 25 ) // Handle likely initial non-recursive value RegDeleteKey( HKEY_CURRENT_USER, pszKey ); RegCloseKey( hKey ); }
int win_ListBox_Select ( char *title, char **lines, // array of string descriptions int num_lines ) // # in array { int i, selection; // If only 1 line available, return index to this line if (num_lines == 1) selection = 0; else { // Allow user to select from a MFC dialog box CArray <CString, CString> list; for (i=0; i<num_lines; i++) list.Add (lines[i]); ListBox dialog (NULL, title); dialog.SetContents (&list); //ShowCursor (TRUE); if (dialog.DoModal () != IDOK) selection = -1; else selection = dialog.GetSelection (); } return (selection); }
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; }
//******************************************************************************* void CBCGPDiagramVisualContainer::RebuildContainer () { ASSERT_VALID (this); //-------------- // Create a copy //-------------- CArray<CBCGPBaseVisualObject*, CBCGPBaseVisualObject*> arNewObjects; int i; for (i = 0; i < m_arObjects.GetSize(); i++) { CBCGPBaseVisualObject* pObject = m_arObjects[i]; if (pObject != NULL) { arNewObjects.Add (pObject); } } //-------- // Replace //-------- m_arObjects.RemoveAll (); m_arObjects.Append (arNewObjects); }
void CPageStream::GetPages(CArray<CPage *, CPage *> &pages, int fromMsec, int toMsec, int offset, int &firstPos, int &lastPos) { AFX_MANAGE_STATE(AfxGetStaticModuleState()); if (m_pageArray.GetSize() <= 0) return; bool isFirst = true; for (int i = 0; i < m_pageArray.GetSize(); ++i) { CPage *page = m_pageArray[i]; if (page && ((page->GetEnd() + offset > fromMsec && page->GetEnd() + offset <= toMsec) || (page->GetBegin() + offset >= fromMsec && page->GetBegin() + offset < toMsec) || (page->GetBegin() + offset < fromMsec && page->GetEnd() + offset > toMsec))) { CPage *newPage = page->Copy(true); if (newPage) { newPage->SetBegin(newPage->GetBegin() + offset); newPage->SetEnd(newPage->GetEnd() + offset); pages.Add(newPage); if (isFirst) firstPos = pages.GetSize() - 1; isFirst = false; } } } // at least one page is inserted if (!isFirst) lastPos = pages.GetSize() - 1; }
/// /// @brief 자식 IE에 DLL 인젝션 /// 자식 IE에 대한 정보를 구조체 배열에 가지고 있는다. /// void InjectDLLToIEChild(CString strProcessName, int nPID) { _TRACE(L"strProcessName : %s, nPID : %d", strProcessName, nPID); wchar_t szTemp[1024] = {0}; CString strTemp; BOOL bWow64 = FALSE; HANDLE hProcess = NULL; INJECT_PROCESS_INFO ipi; hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, nPID); IsWow64Process(hProcess, &bWow64); /// Hook_Web.dll 인젝션 if(strProcessName.CompareNoCase(L"iexplore.exe") == 0) { ipi.hProcess = hProcess; #ifdef WIN64 if(TRUE == bWow64) ipi.strDLL = HOOK_WEB_DLL; else ipi.strDLL = HOOK_WEB_X64_DLL; #else ipi.strDLL = HOOK_WEB_DLL; #endif InjectLibrary(ipi.strDLL, hProcess); g_ArrInjectProcess.Add(ipi); return; } }
// Takes a connected computer to ignore, and a GUID (do) // Randomly chooses a neighbour from amongst those that are connected, running Gnutella2, hubs, and don't know about the GUID // Returns a pointer to that randomly selected neighbour CG2Neighbour* CNeighboursWithG2::GetRandomHub(CG2Neighbour* pExcept, const Hashes::Guid& oGUID) { // Make a new local empty list that will hold pointers to neighbours CArray< CG2Neighbour* > pRandom; // Loop through each computer we're connected to for ( POSITION pos = GetIterator() ; pos ; ) { // Get the neighbour under the current position, and move to the next one in the list CNeighbour* pNeighbour = GetNext( pos ); // If this is a Gnutella2 hub if ( pNeighbour->m_nState == nrsConnected && // We've finished the handshake with this computer, and pNeighbour->m_nProtocol == PROTOCOL_G2 && // It's running Gnutella2 software, and pNeighbour->m_nNodeType != ntLeaf && // Our connection to it isn't down to a leaf, and pNeighbour != pExcept ) // It's not the one the caller told us to avoid { // And it doesn't know the given GUID, add it to the random list if ( static_cast< CG2Neighbour* >( pNeighbour )->m_pGUIDCache->Lookup( oGUID ) == NULL ) pRandom.Add( static_cast< CG2Neighbour* >( pNeighbour ) ); } } // If we didn't find any neighbours to put in the list, return null INT_PTR nSize = pRandom.GetSize(); if ( ! nSize ) return NULL; // Choose a random number between 0 and nSize - 1, use it as an index, and return the neighbour at it nSize = GetRandomNum< INT_PTR >( 0, nSize - 1 ); return pRandom.GetAt( nSize ); }
CArray<CTransparentWnd *,CTransparentWnd *> * CListManager::CloneLayoutArrayPtr(CLayoutList* itemLayout) { CArray<CTransparentWnd *,CTransparentWnd *> * layoutArrayPtr = itemLayout->layoutArrayPtr; CArray<CTransparentWnd *,CTransparentWnd *> *cloneArray = new CArray<CTransparentWnd *,CTransparentWnd *>; int max = layoutArrayPtr->GetSize(); CTransparentWnd * itemWnd = NULL; for (int i=0;i<max; i++) { itemWnd = (*layoutArrayPtr)[i]; if (itemWnd) { //need to clone the display array CTransparentWnd *newWnd = itemWnd->Clone(0,0); if (newWnd) cloneArray->Add(newWnd); } } return cloneArray; }
void CollectElementTags(BSTR ftagName, CArray<IDOMElement*,IDOMElement*>& elements, IDOMElement* parent) { CComQIPtr<IDOMNode> child; parent->get_firstChild(&child); while (child) { CComQIPtr<IDOMElement> element = child; if (element) { BSTR btagName; element->get_tagName(&btagName); _bstr_t tagName = _bstr_t(btagName, false); if (!wcsicmp(tagName, ftagName)) { element.p->AddRef(); elements.Add(element); } CollectElementTags(ftagName, elements, element); // Recurse } CComQIPtr<IDOMNode> nextSibling; child->get_nextSibling(&nextSibling); child = nextSibling; } }
void CSiteDir::BuildFromDatabase() { WCHAR sql[256]; swprintf(sql, L"SELECT id,filename,type,file_size,file_date FROM files WHERE parent_id = %d", m_dbid); _variant_t va; ADODB::_RecordsetPtr recordset = m_pWebSite->m_siteDataConnection->Execute(sql, &va, ADODB::adCmdText); CArray<CSiteDir*,CSiteDir*> dirs; while (recordset->EndOfFile == false) { CSiteItem* pItem; BYTE type = recordset->Fields->Item[_bstr_t("type")]->Value.lVal; if (type == 1) // Directory { CSiteDir* pDir = new CSiteDir; pItem = pDir; strcpy(pDir->m_wfd.cFileName, _bstr_t(recordset->Fields->Item[_bstr_t("filename")]->Value)); _makepath(pDir->m_pathName.GetBuffer(512), NULL, m_pathName, pDir->m_wfd.cFileName, NULL); pDir->m_pathName.ReleaseBuffer(); dirs.Add(pDir); } else if (type == 2) // File { CSiteFile* pFile = new CSiteFile; pItem = pFile; strcpy(pFile->m_wfd.cFileName, _bstr_t(recordset->Fields->Item[_bstr_t("filename")]->Value)); pFile->m_wfd.nFileSizeLow = recordset->Fields->Item[_bstr_t("file_size")]->Value.lVal; } else ATLASSERT(0); if (pItem) { pItem->m_pWebSite = m_pWebSite; pItem->m_dbid = recordset->Fields->Item[_bstr_t("id")]->Value.lVal; // pItem->m_name = pItem->m_wfd.cFileName; // ?? // lastWriteDate double lastWriteTime = recordset->Fields->Item[_bstr_t("file_date")]->Value; SYSTEMTIME systime; VariantTimeToSystemTime(lastWriteTime, &systime); SystemTimeToFileTime(&systime, &pItem->m_wfd.ftLastWriteTime); AddChildTail(pItem); } recordset->MoveNext(); } for (int i = 0; i < dirs.GetSize(); i++) { dirs[i]->BuildFromDatabase(); // Recurse } }
void tagGroupDesc::GroupsFromRecordset(CArray<tagGroupDesc*,tagGroupDesc*> &groups, _RecordsetPtr &rst) { if (rst == NULL) return ; while (!rst->adoEOF) { tagGroupDesc * pGroup = NULL; FieldsPtr fields = rst->Fields; int nGroupId = fields->Item[L"GroupId"]->Value; INT_PTR i = 0; for (; i<groups.GetCount() && groups[i]->Id!=nGroupId; ++i); if (i != groups.GetCount()) { pGroup = groups[i]; } else { pGroup = new tagGroupDesc(nGroupId,fields); groups.Add(pGroup); } tagOpDesc op(fields); if (op.IsValid()) { op.Group = pGroup; pGroup->Ops.Add(op); } rst->MoveNext(); } }
void tagGroupDesc::ToGroups(CArray<tagGroupDesc*,tagGroupDesc*> &groups) { for (INT_PTR i=0; i<Childs.GetCount(); ++i) { groups.Add(Childs[i]); Childs[i]->ToGroups(groups); } }
JNIEXPORT jint JNICALL Java_imc_lecturnity_converter_wizard_UploaderAccess_StartUpload (JNIEnv *env, jclass, jobject joTransferSettings, jobjectArray jaFiles) { HRESULT hr = S_OK; if (s_pUploader == NULL) s_pUploader = new CUploader(); CString csServer; int iProtocol = 0; int iPort = 0; CString csUser; CString csPass; CString csDir; if (SUCCEEDED(hr)) hr = JNISupport::GetStringFromObject(env, joTransferSettings, "m_strServer", csServer); if (SUCCEEDED(hr)) hr = JNISupport::GetIntFromObject(env, joTransferSettings, "m_iProtocol", iProtocol); if (SUCCEEDED(hr)) hr = JNISupport::GetIntFromObject(env, joTransferSettings, "m_iPort", iPort); if (SUCCEEDED(hr)) hr = JNISupport::GetStringFromObject(env, joTransferSettings, "m_strUser", csUser); if (SUCCEEDED(hr)) hr = JNISupport::GetStringFromObject(env, joTransferSettings, "m_strPass", csPass); if (SUCCEEDED(hr)) hr = JNISupport::GetStringFromObject(env, joTransferSettings, "m_strDir", csDir); CArray<CString, CString> aFiles; int iFileCount = env->GetArrayLength(jaFiles); for (int i=0; i<iFileCount && SUCCEEDED(hr); ++i) { jobject joOneFile = env->GetObjectArrayElement(jaFiles, i); CString csOneFile; _TCHAR *tszOneFile = JNISupport::GetTCharFromString(env, (jstring)joOneFile); csOneFile = tszOneFile; if (tszOneFile != NULL) delete[] tszOneFile; if (csOneFile.GetLength() > 0) aFiles.Add(csOneFile); else hr = E_INVALIDARG; } if (SUCCEEDED(hr)) { if (s_pUploader != NULL) { hr = s_pUploader->StartUpload(csServer, iProtocol, iPort, csUser, csPass, csDir, aFiles); } else hr = E_UNEXPECTED; } return (jint)hr; }
Skein::Node* TranscriptWindow::FindRelevantNode(FindAction action, bool next, bool selected) { // Get all the nodes in the transcript or skein CArray<Skein::Node*,Skein::Node*> nodes; if (action == SkeinDifferent) { ASSERT(next); m_skein->GetAllNodes(nodes); } else { Skein::Node* node = m_skeinEndThread; while (node != NULL) { if (next) nodes.InsertAt(0,node); else nodes.Add(node); node = node->GetParent(); } } if (next) nodes.InsertAt(0,(Skein::Node*)NULL); // Return the next relevant node after the selected node (which may be NULL) bool afterSelected = false; for (int i = 0; i < nodes.GetSize(); i++) { if (afterSelected == false) { if (nodes.GetAt(i) == (selected ? m_skeinSelected : NULL)) afterSelected = true; } else { switch (action) { case TranscriptDifferent: case SkeinDifferent: if (nodes.GetAt(i)->GetDiffers() != Skein::Node::ExpectedSame) return nodes.GetAt(i); break; case TranscriptChanged: if (nodes.GetAt(i)->GetChanged()) return nodes.GetAt(i); break; default: ASSERT(FALSE); break; } } } // If nothing found, then if searching the whole skein, start from the beginning if ((action == SkeinDifferent) && selected) return FindRelevantNode(action,next,false); return NULL; }
BOOL CALLBACK EnumProcTopLevelWindowList(HWND hwnd, LPARAM lparam) { CString title = "", winclass = ""; char text[MAX_WINDOW_TITLE] = {0}; RECT crect = {0}; STableList tablelisthold; int tablemap_index = (int)(lparam); write_log(preferences.debug_autoconnector(), "[CAutoConnector] EnumProcTopLevelWindowList(..)\n"); write_log(preferences.debug_autoconnector(), "[CAutoConnector] Tablemap nr. %d\n", tablemap_index); // If this is not a top level window, then return if (GetParent(hwnd) != NULL) return true; // If this window is not visible, then return if (!IsWindowVisible(hwnd)) return true; // If there is no caption on this window, then return GetWindowText(hwnd, text, sizeof(text)); if (strlen(text)==0) return true; title = text; // Found a candidate window, get client area rect write_log(preferences.debug_autoconnector(), "[CAutoConnector] EnumProcTopLevelWindowList(..) found a window candidate...\n"); GetClientRect(hwnd, &crect); // See if it matches the currently loaded table map if (Check_TM_Against_Single_Window(tablemap_index, hwnd, crect, title)) { // Filter out served tables already here, // otherwise the other list used in the dialog // to select windows manually will cause us lots of headaches, // as the lists will be of different size // and the indexes will not match. if (p_sharedmem->PokerWindowAttached(hwnd)) { write_log(preferences.debug_autoconnector(), "[CAutoConnector] Window candidate already served: [%d]\n", hwnd); } else { write_log(preferences.debug_autoconnector(), "[CAutoConnector] Adding window candidate to the list: [%d]\n", hwnd); tablelisthold.hwnd = hwnd; tablelisthold.title = title; tablelisthold.path = p_tablemap_loader->GetTablemapPathToLoad(tablemap_index); tablelisthold.crect.left = crect.left; tablelisthold.crect.top = crect.top; tablelisthold.crect.right = crect.right; tablelisthold.crect.bottom = crect.bottom; g_tlist.Add(tablelisthold); } } return true; // keep processing through entire list of windows }
void Skein::GetAllNodes(CArray<Skein::Node*,Skein::Node*>& nodes, Node* node) { if (node == NULL) node = m_inst.root; nodes.Add(node); for (int i = 0; i < node->GetNumChildren(); i++) GetAllNodes(nodes,node->GetChild(i)); }
void InformApp::GetWindowFrames(CArray<CFrameWnd*>& frames) { if (m_pMainWnd) { if (m_pMainWnd->IsKindOf(RUNTIME_CLASS(CFrameWnd))) frames.Add((CFrameWnd*)m_pMainWnd); } frames.Append(m_frames); }