BOOL CXmlDocument::Load(LPCTSTR lpszFileName) { CWaitCursor waitCursor; CString strXML; try { CFile inputFile(lpszFileName, CFile::modeRead); DWORD dwLength = inputFile.GetLength(); //inputFile.Read(strXML.GetBuffer(dwLength), dwLength); LPTSTR buffer = strXML.GetBuffer(dwLength); inputFile.Read(buffer, dwLength); buffer[dwLength] = 0; strXML.ReleaseBuffer(); inputFile.Close(); } catch(CFileException *ex) { ex->Delete(); return FALSE; } // remove endofline and tabs strXML.Remove('\n'); strXML.Remove('\r'); strXML.Remove('\t'); return Parse(strXML); }
CString FormatNumber(CString number) { CString numberFormated = number; pjsua_acc_id acc_id; pj_str_t pj_uri; bool isLocal = SelectSIPAccount(number,acc_id,pj_uri) && acc_id == account_local; if (!isLocal) { BOOL isDigits = TRUE; for (int i=0;i<number.GetLength();i++) { if ( (number[i]>'9' || number[i]<'0') && number[i]!='*' && number[i]!='#' && number[i]!='.' && number[i]!='-' && number[i]!='(' && number[i]!=')' && number[i]!=' ' && number[0]!='+') { isDigits = FALSE; break; } } if (isDigits) { numberFormated.Remove('.'); numberFormated.Remove('-'); numberFormated.Remove('('); numberFormated.Remove(')'); numberFormated.Remove(' '); } } return GetSIPURI(numberFormated,true,isLocal); }
void Filter::startFiltering(){ editMessageBox.EnableWindow(false); editCommentBox.EnableWindow(false); comboEnabled.EnableWindow(false); comboOptions.EnableWindow(false); GetDlgItem(IDC_BUTTON6)->EnableWindow(false); GetDlgItem(IDC_BUTTON8)->EnableWindow(false); GetDlgItem(IDC_BUTTON9)->EnableWindow(false); amtOfExcludes = 0; amtOfIncludes = 0; uEdit = 0; editMessageBox.SetWindowTextA(""); editCommentBox.SetWindowTextA(""); comboEnabled.SetCurSel(1); comboOptions.SetCurSel(1); for(int i = 0; i < listControl.GetItemCount(); i++){ if(listControl.GetItemText(i,0).Compare("Enabled") == 0){ if(listControl.GetItemText(i,2).Compare("Include") == 0){ CString data = listControl.GetItemText(i,1); data.Remove(' '); listOfIncludes[amtOfIncludes] = data; amtOfIncludes++; }else{ CString data = listControl.GetItemText(i,1); data.Remove(' '); listOfExcludes[amtOfExcludes] = data; amtOfExcludes++; } } } }
CString CIrcWnd::StripMessageOfFontCodes(CString sTemp) { sTemp = StripMessageOfColorCodes(sTemp); sTemp.Remove(_T('\002')); // 0x02 - BOLD //sTemp.Remove(_T('\003')); // 0x03 - COLOUR sTemp.Remove(_T('\017')); // 0x0f - RESET sTemp.Remove(_T('\026')); // 0x16 - REVERSE/INVERSE was once italic? sTemp.Remove(_T('\037')); // 0x1f - UNDERLINE return sTemp; }
bool operator < (const SortedACE& b) { CString first = name; CString second = b.name; first.Remove('*'); second.Remove('*'); return first < second; }
BOOL CLogFactory::CreateLogName(BSTR AppName, BSTR Configue, BSTR Section, LONG FileType, CString &strLogName) { CString strError; CString strAppPath(AppName); CString strFileName(Configue); CString strSection(Section); if (!IsFileExisted(strAppPath)) { strError.Format(_T("AppName:%s is not existed. CLogFactory::CreateLogName return FALSE."), strAppPath); LOGGER_WRITE(strError.GetBuffer()); LogEvent(strError); return FALSE; } strError.Format(_T("AppName:%s"), strAppPath); LOGGER_WRITE(strError.GetBuffer()); int iIndex = strAppPath.ReverseFind(_T('\\')); ATLASSERT(-1 != iIndex); strAppPath = strAppPath.Left(iIndex + 1); CParameter Parameter; CConfigReader Reader; Reader.Read(strAppPath, strFileName, strSection, FileType, Parameter); CHAR Buffer[MAX_PATH] = { 0 }; #pragma warning(push) #pragma warning(disable: 4996) strcat(Buffer, Parameter.m_cFixFolder); strcat(Buffer, Parameter.m_cCycleFolder); strcat(Buffer, Parameter.m_cCycleName); strcat(Buffer, Parameter.m_cCreateTime); strcat(Buffer, Parameter.m_cSaveTime); strcat(Buffer, Parameter.m_cExeName); #pragma warning(pop) strLogName = CString(Buffer); strLogName.Remove(_T('\\')); strLogName.Remove(_T(':')); strLogName.Remove(_T('.')); strLogName.Remove(_T(' ')); LOGGER_WRITE2(_T("LogName:") << strLogName.GetBuffer() << _T(" FileType:") << FileType); return TRUE; }
void CAutoRegisterConfig::ReadFrom() { CString iniFile = theApp.GetWorkPath(); iniFile.Append(_T("\\IBAConfig\\register.ini")); { CString str; ::GetPrivateProfileString(_T("Base"), _T("Amount24"), _T(""), str.GetBuffer(200), 200, iniFile); str.ReleaseBuffer(); Set24Amount(str); } { m_arrayRandomAmount.clear(); CString str; ::GetPrivateProfileString(_T("Base"), _T("RandomAmount"), _T("5,10,20"), str.GetBuffer(200), 200, iniFile); str.ReleaseBuffer(); CStringArray strArray; CIBAHelpper::SplitLine(str, strArray, _T(',')); for (int i = 0; i < strArray.GetCount(); i++) { m_arrayRandomAmount.push_back(_ttoi(strArray.GetAt(i))); } } { CString str; ::GetPrivateProfileString(_T("Base"), _T("StartTime"), _T(""), str.GetBuffer(200), 200, iniFile); str.ReleaseBuffer(); str.Remove(_T(' ')); str.Remove(_T('-')); str.Remove(_T(':')); m_startTime = CIBAHelpper::CenterTimeToOleDateTime(str); } { CString str; ::GetPrivateProfileString(_T("Base"), _T("EndTime"), _T(""), str.GetBuffer(200), 200, iniFile); str.ReleaseBuffer(); str.Remove(_T(' ')); str.Remove(_T('-')); str.Remove(_T(':')); m_endTime = CIBAHelpper::CenterTimeToOleDateTime(str); } { CString str; ::GetPrivateProfileString(_T("Base"), _T("IDFile"), _T(""), str.GetBuffer(200), 200, iniFile); str.ReleaseBuffer(); m_strFilePath = str; } }
BOOL CCtrlInfo::Modify(const CWnd* pCtrl, const CWnd* pParent, LPCTSTR lpszString, char chSpr /*= '+'*/) { ASSERT(::IsWindow(pCtrl->m_hWnd)); ASSERT(::IsWindow(pParent->m_hWnd)); ASSERT(::IsChild(pParent->m_hWnd, pCtrl->m_hWnd)); pCtrl->GetWindowRect(&m_rcInit); pParent->ScreenToClient(&m_rcInit); // XR: Get position information from Initialization string CString str = lpszString; str.Remove(' '); str.MakeUpper(); int nLen = str.GetLength(); int posSpr = -1; int posSprNext = 0; while(posSprNext != -1) { CString strSection; posSprNext = str.Find(chSpr, posSpr + 1); // XR: default separator between sections is '+' if (posSprNext == -1) strSection = str.Mid(posSpr + 1, nLen - posSpr - 1); else strSection = str.Mid(posSpr + 1, posSprNext - posSpr - 1); if (!this->ExtractOptions(strSection, pCtrl, pParent)) return FALSE; posSpr = posSprNext; } return TRUE; }
CString CNBUnitDevice::GetIDString(TCHAR HiddenChar) { CString strText; if (m_pDevice) { CString strID = m_pDevice->m_BaseInfo.szDeviceStringId; strID.Remove(_T('-')); strText += strID.Mid(0, 5) + _T("-") + strID.Mid(5, 5) + _T("-") + strID.Mid(10, 5) + _T("-"); strText += HiddenChar; strText += HiddenChar; strText += HiddenChar; strText += HiddenChar; strText += HiddenChar; // strID.Mid(0, 5) + _T("-") + } else { // // to do: create ID from device ID.(But we don't have corresponding NDAS device object!!) // strText += ""; } return strText; }
BOOL CBonfireDoc::ExistsSourceView(LPCTSTR lpszPathName) { CStringList pTabList; CString ext = (lpszPathName == NULL) ? GetFileExtension(GetPathName()) : GetFileExtension(lpszPathName); // generate tabs based on the file extension CString strViews = theApp.m_opOptions.views.vAssociations[0].strViews; // init to default views CString strExtList = ""; size_t nExt = theApp.m_opOptions.views.vAssociations.size(); // see if the current file's extension is in the list while (nExt-- > 0) // 0 is the default file extension { strExtList = (CString)theApp.m_opOptions.views.vAssociations[nExt].strExtensions; strExtList.Remove(' '); if (IsStringPresent(strExtList, ext)) { strViews = theApp.m_opOptions.views.vAssociations[nExt].strViews; break; } } return (strViews[0] != '-' || strViews[0] == 's'); }
CString CUDSMainWnd::initialEval(CString Data2Send ) { int CService; CService = strtol(CurrentService, NULL, 16); if ( CService==0x10 || CService==0x11 ||CService==0x28 ||CService==0x31 ||CService==0x3E ||CService==0x85 ||CService==0xA0) { CString SendingData = Data2Send; //SendingData.Replace(" ",""); //added by Alejandra - not working SendingData.Remove(' '); // added in adition to previos function not working SendingData = Data2Send.Right(Data2Send.GetLength() - NO_OF_CHAR_IN_BYTE); int pos; pos = SendingData.Find('8', 0); //CString SecondByte = SendingData.Left(1); //added by Alejandra - not working if(pos == 1) //initial if(SecondByte == '8') { Font_Color = RGB(0,255,0 ); return " No Response Required"; } } Font_Color = RGB(184,134,11 ); return " No Response Received"; // If it's the case of No Positive Response Required return the default value }
bool CFloatEdit::Validate() { CString text; this->GetWindowTextA(text); text.Trim(); // empty string if(text.IsEmpty()) { return false; } // there is at least one number if(text.FindOneOf("0123456789") == -1) { return false; } // character besides digits or period? if(text.SpanIncluding("0123456789.-") != text) { return false; } // minus sign is not only in the first spot. implies only one minus sign if(text.ReverseFind('-') > 0) { return false; } // more than one period? if(text.Remove('.') > 1) { return false; } return true; }
//*************************************************************************************** BOOL CBCGPXMLSettings::WriteTag (LPCTSTR pszKey, LPCTSTR lpszBuffer) { ASSERT (pszKey != NULL); ASSERT (lpszBuffer != NULL); if (m_bReadOnly) { ASSERT (FALSE); return FALSE; } if (m_pCurrNode == NULL) { ASSERT (FALSE); return FALSE; } ASSERT_VALID (m_pCurrNode); CString strKey = pszKey; strKey.Remove (_T(' ')); CBCGPXMLNode* pNode = m_pCurrNode->FindChild (strKey); if (pNode == NULL) { pNode = new CBCGPXMLNode; pNode->m_strName = strKey; m_pCurrNode->AddChild (pNode); } pNode->m_strValue = lpszBuffer; return TRUE; }
BOOL CCoolFormat3Doc::DoSave( LPCTSTR lpszPathName, BOOL bReplace /*= TRUE*/ ) { if ( lpszPathName == NULL ) { TCHAR szPath[MAX_PATH]; CString strDefault = GetTitle(); strDefault.Remove('*'); strDefault = strDefault.Trim(); CString strFilter = _T("All Files(*.*)|*.*|") _T("C/C++ Files(*.c;*.cpp;*.h;*.hpp)|*.c;*.cpp;*.h;*.hpp|") _T("C# Files(*.cs)|*.cs|") _T("Java Files(*.java)|*.java||"); g_GlobalUtils.m_sLanguageExt.GetAllLanguageFilter(strFilter); DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT|OFN_EXTENSIONDIFFERENT; CFileDialog dlg(FALSE, NULL, strDefault, dwFlags, strFilter, NULL); if ( dlg.DoModal() == IDOK ) { CString strTemp = dlg.GetPathName(); if (dlg.m_ofn.nFilterIndex < MAX_SYN_LANG + 1 && dlg.m_ofn.nFilterIndex > 1) { CString strExt; g_GlobalUtils.m_sLanguageExt.GetLanguageOneFilter(dlg.m_ofn.nFilterIndex - 2, strExt); strTemp.Append(strExt); } lstrcpy(szPath, strTemp.GetBuffer(0)); lpszPathName = szPath; } else return FALSE; } return CDocument::DoSave(lpszPathName, bReplace); }
BOOL CMediaSettingsPage::OnInitDialog() { CSettingsPage::OnInitDialog(); m_bEnablePlay = Settings.MediaPlayer.EnablePlay; m_bEnableEnqueue = Settings.MediaPlayer.EnableEnqueue; for ( string_set::const_iterator i = Settings.MediaPlayer.FileTypes.begin() ; i != Settings.MediaPlayer.FileTypes.end(); ++i ) { m_wndList.AddString( *i ); } m_wndServices.AddString( _T("(") + LoadString( IDS_GENERAL_CUSTOM ) + _T("\x2026)") ); m_wndServices.AddString( LoadString( IDS_MEDIA_SMPLAYER ) ); int nSelected = nSnareazaIndex; for ( string_set::const_iterator i = Settings.MediaPlayer.ServicePath.begin() ; i != Settings.MediaPlayer.ServicePath.end(); ++i ) { CString sPlayer = *i; int nAstrix = sPlayer.ReverseFind( _T('*') ); sPlayer.Remove( _T('*') ); int nIndex = m_wndServices.AddString( PathFindFileName( sPlayer ) ); if ( nAstrix != -1 ) // Selected player nSelected = nIndex; m_wndServices.SetItemDataPtr( nIndex, new CString( sPlayer ) ); } m_wndServices.SetCurSel( nSelected ); UpdateData( FALSE ); Update(); return TRUE; }
void CKademliaWnd::UpdateControlsState() { if (!::IsWindow(m_hWnd)) return; CString strLabel; if (Kademlia::CKademlia::IsConnected()) strLabel = GetResString(IDS_MAIN_BTN_DISCONNECT); else if (Kademlia::CKademlia::IsRunning()) strLabel = GetResString(IDS_MAIN_BTN_CANCEL); else strLabel = GetResString(IDS_MAIN_BTN_CONNECT); strLabel.Remove(_T('&')); GetDlgItem(IDC_KADCONNECT)->SetWindowText(strLabel); CString strBootstrapIP; GetDlgItemText(IDC_BOOTSTRAPIP, strBootstrapIP); CString strBootstrapPort; GetDlgItemText(IDC_BOOTSTRAPPORT, strBootstrapPort); GetDlgItem(IDC_BOOTSTRAPBUTTON)->EnableWindow( !Kademlia::CKademlia::IsConnected() && ( ( IsDlgButtonChecked(IDC_RADIP)>0 && !strBootstrapIP.IsEmpty() && (strBootstrapIP.Find(_T(':')) != -1 || !strBootstrapPort.IsEmpty()) ) || IsDlgButtonChecked(IDC_RADCLIENTS)>0)); }
void CClientListCtrl::Init() { SetName(_T("ClientListCtrl")); CImageList ilDummyImageList; //dummy list for getting the proper height of listview entries ilDummyImageList.Create(1, theApp.GetSmallSytemIconSize().cy,theApp.m_iDfltImageListColorFlags|ILC_MASK, 1, 1); SetImageList(&ilDummyImageList, LVSIL_SMALL); ASSERT( (GetStyle() & LVS_SHAREIMAGELISTS) == 0 ); ilDummyImageList.Detach(); SetExtendedStyle(LVS_EX_FULLROWSELECT); InsertColumn(0,GetResString(IDS_QL_USERNAME),LVCFMT_LEFT,150,0); InsertColumn(1,GetResString(IDS_CL_UPLOADSTATUS),LVCFMT_LEFT,150,1); InsertColumn(2,GetResString(IDS_CL_TRANSFUP),LVCFMT_LEFT,150,2); InsertColumn(3,GetResString(IDS_CL_DOWNLSTATUS),LVCFMT_LEFT,150,3); InsertColumn(4,GetResString(IDS_CL_TRANSFDOWN),LVCFMT_LEFT,150,4); InsertColumn(5,GetResString(IDS_CD_CSOFT),LVCFMT_LEFT,150,5); InsertColumn(6,GetResString(IDS_CONNECTED),LVCFMT_LEFT,150,6); CString coltemp; coltemp=GetResString(IDS_CD_UHASH);coltemp.Remove(':'); InsertColumn(7,coltemp,LVCFMT_LEFT,150,7); SetAllIcons(); Localize(); LoadSettings(); SetSortArrow(); SortItems(SortProc, GetSortItem()+ (GetSortAscending()? 0:100)); }
BOOL CHistoryDlg::OnInitDialog() { CResizableStandAloneDialog::OnInitDialog(); // calculate and set listbox width CDC* pDC=m_List.GetDC(); CSize itemExtent; int horizExtent = 1; for (size_t i = 0; i < m_history->GetCount(); ++i) { CString sEntry = m_history->GetEntry(i); sEntry.Remove('\r'); sEntry.Replace('\n', ' '); m_List.AddString(sEntry); itemExtent = pDC->GetTextExtent(sEntry); horizExtent = max(horizExtent, itemExtent.cx+5); } m_List.SetHorizontalExtent(horizExtent); ReleaseDC(pDC); AddAnchor(IDC_HISTORYLIST, TOP_LEFT, BOTTOM_RIGHT); AddAnchor(IDOK, BOTTOM_RIGHT); AddAnchor(IDCANCEL, BOTTOM_RIGHT); EnableSaveRestore(_T("HistoryDlg")); m_List.SetFocus(); return FALSE; }
bool GetWinShellLocation(CString &sWinShell) { CRegistry theRegistry; sWinShell.Empty(); g_sEditor.Empty(); if (theRegistry.Connect(HKEY_LOCAL_MACHINE) == FALSE) { // theLog("Registry: can't connect to HKEY_LOCAL_MACHINE (Error %d)\n", // GetLastError()); return false; } if (theRegistry.Open(TEXT("SOFTWARE\\Classes\\tex_auto_file\\DefaultIcon"), (CRegistry::CreatePermissions)CRegistry::permissionRead) == FALSE ) { // theLog("Registry: can't open WinShell.Document\\DefaultIcon key (Error %d)\n", // GetLastError()); theRegistry.Close(); return false; } theRegistry.GetValue("", sWinShell); theRegistry.Close(); // It might be quoted ! sWinShell.Remove(TEXT('\"')); sWinShell.Remove(TEXT('\'')); ::GetParentDirectory(sWinShell); g_sEditor = ConcatPath(sWinShell, "WinShell.exe"); if (! FileExists(g_sEditor)) { g_sEditor.Empty(); sWinShell.Empty(); return false; } return true; }
int ODBCStringsMatrix::CutToSmallStrings(char* szString, CStringArray& arrSmallStrings) { int nLoop = 0; int nStart = 0; arrSmallStrings.RemoveAll(); while( szString[nLoop] != '\0' ) { if( szString[nLoop] == ' ' ) { char cOld = szString[nLoop]; szString[nLoop] = '\0'; CString sValue = (LPCTSTR)&szString[nStart]; szString[nLoop] = cOld; if( sValue.GetLength() ) arrSmallStrings.Add(sValue); nStart = nLoop + 1; } nLoop ++; } CString sValue = (LPCTSTR)&szString[nStart]; sValue.Remove(' '); if( sValue.GetLength() ) arrSmallStrings.Add(sValue); return (long)arrSmallStrings.GetCount(); }
// remove the "*" and return for the purpose of roster... CString CAirlineID::GetNonStarValue() const { CString str; str = m_psz; str.Remove( '*' ); return str; }
CString GetJsonValue(CString str,CString key) { str.Remove('{'); str.Remove('}'); int index=0; CString resToken=str.Tokenize(_T(","),index); while (resToken != _T("")) { int index1=0; CString resToken1=resToken.Tokenize(_T(":"),index1); int flag=0; while(resToken1!=_T("")) { if (flag) { return resToken1; } if (resToken1==key) { flag=1; } resToken1=resToken.Tokenize(_T(":"),index1); } resToken=str.Tokenize(_T(","),index); } return _T(""); }
/* 呼叫业务顾问 */ void CCallThread::OnCallBusc(CallerCmd& callerCmd) { UINT winID = callerCmd.GetWindowId();//窗口ID callerCmd.SetSuccess(TRUE); //playsound,display SLZWindow Window; BOOL flag = m_rInlineQueData.m_rWindowTable.QueryWindowById(winID,Window); if(!flag)return; CString callName = Window.GetWindowCallName(); CString strMsg; callName.Remove(_T('号')); callName.Remove(_T('窗')); callName.Remove(_T('口')); strMsg.Format(_T("#请#业务顾问#到#%s#号窗口"),callName); theApp.m_Controller.m_pPlaySound->DataPlay(strMsg); }
bool EPropertyTextblock::OnPropApply() { bool bChangeOK = false; if( m_pPropertyEditWindow == NULL ) { } else { CString s = m_pPropertyEditWindow->GetEditText(); int nNumRemoved = s.Remove(13); //remove cariage return bChangeOK = m_pHost->PropertyChanging( m_pProperty , &s ); if( bChangeOK ) { *((CString*)m_pProperty) = s; } CloseEditWindow(); } return bChangeOK; }
CString ProjectProperties::MakeShortMessage(const CString& message) { bool bFoundShort = true; CString sShortMessage = GetLogSummary(message); if (sShortMessage.IsEmpty()) { bFoundShort = false; sShortMessage = message; } // Remove newlines and tabs 'cause those are not shown nicely in the list control sShortMessage.Remove('\r'); sShortMessage.Replace(_T('\t'), _T(' ')); // Suppose the first empty line separates 'summary' from the rest of the message. int found = sShortMessage.Find(_T("\n\n")); // To avoid too short 'short' messages // (e.g. if the message looks something like "Bugfix:\n\n*done this\n*done that") // only use the empty newline as a separator if it comes after at least 15 chars. if ((!bFoundShort)&&(found >= 15)) { sShortMessage = sShortMessage.Left(found); } sShortMessage.Replace('\n', ' '); return sShortMessage; }
void operator()(const char *begin, const char *end) const { std::string text = std::string(begin, end); CString ctext = text.c_str(); #ifdef DEBUG_USER_VARIABLES cout << endl << "Uservariable to be set: " << ctext << endl; #endif // Removing underscores, as they are used as separators // and would mix things up, e.g. me_st_Pi_3_141592653 ctext.Remove('_'); //Add to list of user variables if not yet known CSMap::const_iterator find_result = user_vars.find(ctext.MakeLower()); if (find_result == user_vars.end()) { user_vars[ctext.MakeLower()] = ctext.MakeLower(); } when_conditions_since_last_action = 0; if (open_ended_when_condition_detected) { cout << current_open_ended_when_condition.str() << " && [" << current_when_condition.str() << " ? " << "me_st_" << ctext.MakeLower() << "_1 : 0] && 0 ? 0 :" << endl; } else { cout << "[ " << current_when_condition.str() << " ? " << "me_st_" << ctext.MakeLower() << "_1 : 0] && 0 ? 0 :" << endl; } current_output.str(""); current_output.clear(); }
//*************************************************************************************** BOOL CBCGPXMLSettings::DeleteKey (LPCTSTR pszPath, BOOL bAdmin) { if (m_bReadOnly) { return FALSE; } CBCGPXMLNode* pNode = bAdmin ? &m_Local : &m_User; ASSERT (pszPath != NULL); CString strPath = pszPath; int iPathLen = strPath.GetLength (); if (iPathLen > 0 && strPath [iPathLen - 1] != _T('\\')) { strPath += _T('\\'); } for (int iFrom = 0; iFrom < strPath.GetLength ();) { int iEnd = strPath.Find (_T('\\'), iFrom); if (iEnd < 0) { ASSERT (FALSE); return FALSE; } CString strSubKey = strPath.Mid (iFrom, iEnd - iFrom); strSubKey.Remove (_T(' ')); CBCGPXMLNode* pChild = pNode->FindChild (strSubKey); if (pChild == NULL) { return FALSE; } pNode = pChild; iFrom = iEnd + 1; } ASSERT_VALID (pNode->m_pParent); for (POSITION pos = pNode->m_pParent->m_lstChildren.GetHeadPosition (); pos != NULL;) { POSITION posSave = pos; CBCGPXMLNode* pCurrNode = pNode->m_pParent->m_lstChildren.GetNext (pos); ASSERT_VALID (pCurrNode); if (pNode == pCurrNode) { pNode->m_pParent->m_lstChildren.RemoveAt (posSave); delete pNode; return TRUE; } } ASSERT(FALSE); return FALSE; }
int CTrivia::ContainsStringExact(CString strLine, CString strSubString, BOOL bCase, BOOL bExactMatch) { if(strLine.IsEmpty()) return FALSE; if(strSubString.IsEmpty()) return TRUE; int nReturn = -1; BOOL bFound = FALSE; if(!bCase){ strLine.MakeLower(); strSubString.MakeLower(); } if(bExactMatch){ if(strLine == strSubString){ return 0; } else{ return -1; } } CString strSearch = strSubString; strSearch.Remove('*'); int nIndex = -1; BOOL bFront, bEnd; if((nIndex = strLine.Find(strSearch, 0)) >= 0){ //Check if there is a space or ( at front and end of searched item bEnd = (nIndex + strSearch.GetLength() >= strLine.GetLength() ? TRUE : strLine.GetAt(strSearch.GetLength() + nIndex) == ' '); bFront = (nIndex > 0 ? strLine.GetAt(nIndex-1) == ' ' : TRUE); if((strSubString.GetAt(0) == '*') && (strSubString.GetAt(strSubString.GetLength()-1) == '*')){ bFound = TRUE; } else if((strSubString.GetAt(0) == '*') && (strSubString.GetAt(strSubString.GetLength()-1) != '*')){ bFound = bEnd; } else if((strSubString.GetAt(0) != '*') && (strSubString.GetAt(strSubString.GetLength()-1) == '*')){ bFound = bFront; } else{ bFound = bFront && bEnd; } if(bFound){ nReturn = nIndex; } } return nReturn; }
void CMcviewDlg::OnLoop() { // test code for bug-2003-7-19 // TerminateProcess(GetCurrentProcess(), 0); // no use, not caused by this theView.SetFocus(); CWnd *pWndLoop = GetDlgItem(IDC_LOOP); if(m_bShowLoop){ m_bShowLoop = false; KillTimer(2); pWndLoop->SetWindowText("循环"); return; } CDlgLoop dlgLoop; dlgLoop.m_interval = m_loopInterval; if(dlgLoop.DoModal() != IDOK){ return; } m_loopCurrent = 0; m_loopCount = 0; CString sLoopFile = ((CMcviewApp*)::AfxGetApp())->m_path+"loops"; FILE *pLoops = fopen((LPCTSTR)sLoopFile, "r"); ASSERT(pLoops != NULL); CString sItem; char buf[1024]; while(fgets(buf, 1024, pLoops)){ sItem = buf; sItem.Remove(10); sItem.Remove(13); m_viewLoop[m_loopCount] = sItem + ".gdf"; m_loopCount++; if(m_loopCount >= 32){ break; } } fclose(pLoops); if(m_loopCount < 2){ return; } m_loopInterval = dlgLoop.m_interval; m_bShowLoop = true; SetTimer(2, m_loopInterval * 1000, NULL); pWndLoop->SetWindowText("停止"); theView.LoadFile(m_viewLoop[m_loopCurrent]); m_loopCurrent++; if(m_loopCurrent >= m_loopCount){ m_loopCurrent = 0; } }
void CTortoiseProcApp::DoInitializeJumpList(const CString& appid) { ATL::CComPtr<ICustomDestinationList> pcdl; HRESULT hr = pcdl.CoCreateInstance(CLSID_DestinationList, NULL, CLSCTX_INPROC_SERVER); if (FAILED(hr)) return; hr = pcdl->SetAppID(appid); if (FAILED(hr)) return; UINT uMaxSlots; ATL::CComPtr<IObjectArray> poaRemoved; hr = pcdl->BeginList(&uMaxSlots, IID_PPV_ARGS(&poaRemoved)); if (FAILED(hr)) return; ATL::CComPtr<IObjectCollection> poc; hr = poc.CoCreateInstance(CLSID_EnumerableObjectCollection, NULL, CLSCTX_INPROC_SERVER); if (FAILED(hr)) return; CString sTemp = CString(MAKEINTRESOURCE(IDS_MENUSETTINGS)); sTemp.Remove('&'); ATL::CComPtr<IShellLink> psl; hr = CreateShellLink(_T("/command:settings"), (LPCTSTR)sTemp, 20, &psl); if (SUCCEEDED(hr)) { poc->AddObject(psl); } sTemp = CString(MAKEINTRESOURCE(IDS_MENUHELP)); sTemp.Remove('&'); psl.Release(); // Need to release the object before calling operator&() hr = CreateShellLink(_T("/command:help"), (LPCTSTR)sTemp, 19, &psl); if (SUCCEEDED(hr)) { poc->AddObject(psl); } ATL::CComPtr<IObjectArray> poa; hr = poc.QueryInterface(&poa); if (SUCCEEDED(hr)) { pcdl->AppendCategory((LPCTSTR)CString(MAKEINTRESOURCE(IDS_PROC_TASKS)), poa); pcdl->CommitList(); } }