void CRSAFactorHintDlg::OnChangeGuessP() 
{
	UpdateData();
	if(m_choice==0){
		int base=(m_base*6+10)%20;
		CString GuessPString;
		if(m_msbLsb==0){
			GetDlgItemText(IDC_EDITGUESSP_LEFT,GuessPString);
			//	SetDlgItemText(IDC_EDITGUESSP_RIGHT,GuessPString);
		}
		else{
			GetDlgItemText(IDC_EDITGUESSP_RIGHT,GuessPString);
			//	SetDlgItemText(IDC_EDITGUESSP_LEFT,GuessPString);
		}
		ZZ tmpGuessP=setToStringValue(GuessPString,base);
		int bitsOfGuess=NumBits(tmpGuessP);
		int z=0;
		for(int i=0; i<GuessPString.GetLength()
			&&(GuessPString.GetAt(i)=='0'
			||GuessPString.GetAt(i)==' '); i++)
			if(GuessPString.GetAt(i)=='0')
				z++;
			int zeroBits=NumBits(power(to_ZZ(base),z)-1);
			bitsOfGuess+=zeroBits;
			m_GuessP=tmpGuessP;
			SetDlgItemInt(IDC_EDITB, bitsOfGuess);
	}
	UpdateData(false);
	//updateDim();
}
Example #2
0
BOOL CChatWnd::OnLocalText(const CString& sText)
{
    // Save history
    m_pHistory.Add( sText );
    if ( m_pHistory.GetSize() > EDIT_HISTORY ) m_pHistory.RemoveAt( 0 );
    m_nHistory = static_cast< int >( m_pHistory.GetSize() );

    if ( sText.GetAt( 0 ) == _T('/') )
    {
        CString strCommand = sText.SpanExcluding( _T(" \t") ).Trim();
        if ( strCommand.CompareNoCase( _T("/me") ) == 0 )
        {
            // Action text
            return OnLocalMessage( true, sText.Mid( 4 ) );
        }
        else if ( OnLocalCommand( strCommand, sText.Mid( strCommand.GetLength() + 1 ).Trim() ) )
        {
            // Handled command
            return TRUE;
        }
    }
    else if ( sText.GetAt( 0 ) == _T('*') &&
              ( sText.GetAt( 1 ) == _T(' ') || sText.GetAt( 1 ) == _T('\t') ) )
    {
        // Action text
        return OnLocalMessage( true, sText.Mid( 2 ) );
    }

    // Regular text
    return OnLocalMessage( false, sText );
}
Example #3
0
CString ExtractKeyword(CString line) // "  function(..)     " will return "function"
{
	int length = line.GetLength();
	int start = -1;
	int end = length;

	for(int a = 0; a < length; a++)
	{
		if(KeywordLetter(line.GetAt(a)))
		{
			start = a;
			a = length;
		}
	}

	if(start == -1)
		return CString("");

	for(int a = start; a < length; a++)
	{
		if(!KeywordLetter(line.GetAt(a)))
		{
			end = a;
			a = length;
		}
	}
	return line.Mid(start, end-start);
}
Example #4
0
static BYTE GetByte(CString message, int index) 
{
	if (index*2+1 > message.GetLength() )
		throw CPException();

	TCHAR c1 = toupper(message.GetAt(index*2));
	TCHAR c2 = toupper(message.GetAt(index*2+1));
	
	return (HexValue(c1)*16) + HexValue(c2);
}
Example #5
0
BOOL CSimpleSAH::SetAttribute(LPCSTR lpAttriName, LPCSTR lpNewVal)
{
	CString tmp;
	CString tag(strCurTagBuf);
	tag.MakeLower();
	CString attri(lpAttriName);
	attri.MakeLower();

	BOOL found = FALSE;
	try{

	CString s;
	int i=0, j=0;
	while(!found)
	{
		i = tag.Find(attri, i);
		if(i<0)
			break;

		j = tag.Find('=', i);
		s = tag.Mid(i+attri.GetLength(), j-i-attri.GetLength());
		s.TrimLeft();
		if(s.IsEmpty())
		{
			found=TRUE;
			tmp = strCurTagBuf.Mid(j+1); tmp.TrimLeft();
			tag = strCurTagBuf.Left(j+1); //XXX=
			tag += "\"";
			tag += lpNewVal;
			tag += "\"";  //XXX="VVV" 

			if(tmp.GetAt(0) == '\"' || tmp.GetAt(0) == '\'') //quated string
			{
				tmp = tmp.Right(tmp.GetLength()-1);
				i = tmp.FindOneOf("\'\"\r\n>");
				if(tmp.GetAt(i) == '\"' || tmp.GetAt(i) == '\'')
					i++;
			}
			else
				i = tmp.FindOneOf(" \r\n>\'\"");
			tag += strCurTagBuf.Right(tmp.GetLength() - i);
			strCurTagBuf = tag;
		}
		i += attri.GetLength();
	}
	}
	catch(...)
	{
	}

	return found;
}
Example #6
0
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;
}
Example #7
0
void FromAToB(){
	DWORD dwRead, dwWrite;
	char* pReadBuf;
	CString cStrData;
	char* pSendData;
	while (1){
		pReadBuf = new char[101];
		//从匿名通道读入
		if (!ReadFile(hPipeRead, pReadBuf, 101, &dwRead, NULL)){
			printf("read failed\n");
		}
		cStrData.Empty();
		cStrData = pReadBuf;
		while (!cStrData.IsEmpty()){
			pSendData = new char[cStrData.GetLength() + 1];
			memset(pSendData, 0, cStrData.GetLength() + 1);
			for (int i = 0; i < cStrData.GetLength() + 1; i++){
				pSendData[i] = (char)cStrData.GetAt(i);
			}
			//将从A中读入的数据通过匿名通道写入B
			if (!WriteFile(hPipeWrite, pReadBuf, strlen(pReadBuf), &dwWrite, NULL)){
				printf("write failed\n");
			}
		}
	}
	
}
Example #8
0
BOOL CVolume::ValidateLabel(const CString& strLabel)
{
	CString strTemp = strLabel;
	strTemp.Trim();

	// Check length.
	if (strTemp.IsEmpty() || strTemp.GetLength() >3) return FALSE;

	// Check label.
	strTemp.MakeUpper();
	TCHAR chLabel = strTemp.GetAt(0);
	if (chLabel < _T('A') || chLabel > _T('Z')) return FALSE;

	// Check whole string.
	switch (strTemp.GetLength())
	{
	case 1:
		return TRUE;
	case 2:
		{
			CString strCompare;
			strCompare.Format(_T("%c:"),chLabel);
			return strTemp.CompareNoCase(strCompare) ? FALSE : TRUE;
		}
	case 3:
		{
			CString strCompare;
			strCompare.Format(_T("%c:\\"),chLabel);
			return strTemp.CompareNoCase(strCompare) ? FALSE : TRUE;
		}
	default: 
		return FALSE;
	}
}
Example #9
0
BOOL CVolumeCollection::IsVolumeExist(const CString& strLabel)
{
	if (!CVolume::ValidateLabel(strLabel)) return FALSE;

	CVolume::ValidateLabel(strLabel);
	return m_dwVolumes & (0x1 << (strLabel.GetAt(0) - _T('A'))) ? TRUE : FALSE;
}
Example #10
0
//===========================================================================
int CFAVReaderDlg::CStringHexToInt(CString str)
//===========================================================================
{
	int nRet = 0;
	int count = 1;
	for(int i = str.GetLength()-1; i >= 0; --i)
	{
		int nNum = 0;
		char chText;
		chText = str.GetAt(i);
		if (chText >= '0' && chText <= '9')
		{
			nNum = chText - '0';
		}
		else if (chText >= 'A' && chText <= 'F')
		{
			nNum = chText - 'A' + 10;
		}
		else if (chText >= 'a' && chText <= 'f')
		{
			nNum = chText - 'a' + 10;
		}
		nRet += nNum*count;
		count *= 16;

	}
	return nRet;
}
Example #11
0
void CDialog2::BuildOutputFileName()
{
	UpdateData(true);
	if( m_input.IsEmpty() )
	{
		m_output = "";
		UpdateData(false);
		return;
	}
	
	CString path= (usedefpath && !m_defpath.IsEmpty()) ? m_defpath : CWindow::GetPath(m_input); 
	CString name= CWindow::GetFileNameNoExt( m_output.IsEmpty() ? m_input : m_output );
	CString ext = CWindow::GetExtName(m_input);
	CString newext = (run_type==DECRYPT) ? "" : (format==MCS) ? "mcs" : "des";
	
	if( path.GetAt( path.GetLength()-1 ) != '\\' )
		path += "\\";
	if( run_type==DECRYPT )
		if( ext.GetLength()>4 && ext.GetAt(ext.GetLength()-4)=='.' )
			ext = ext.Left( ext.GetLength()-4 );
		else
			ext = "";
		
		m_output = path + name;
		if( ext.GetLength() )
			m_output += "." + ext;
		if( newext.GetLength() )
			m_output += "." + newext;
	UpdateData(false);


}
void CEditPropExternalsValue::OnBnClickedBrowse()
{
    SVNRev rev = SVNRev::REV_HEAD;
    CAppUtils::BrowseRepository(m_URLCombo, this, rev, false, m_RepoRoot.GetSVNPathString(), m_URL.GetSVNPathString());

    // if possible, create a repository-root relative url
    CString strURLs;
    m_URLCombo.GetWindowText(strURLs);
    if (strURLs.IsEmpty())
        strURLs = m_URLCombo.GetString();
    strURLs.Replace('\\', '/');
    strURLs.Replace(L"%", L"%25");

    CString root = m_RepoRoot.GetSVNPathString();
    int rootlength = root.GetLength();
    if (strURLs.Left(rootlength).Compare(root)==0)
    {
        if ((strURLs.GetLength() > rootlength) && (strURLs.GetAt(rootlength) == '/'))
        {
            strURLs = L"^/" + strURLs.Mid(rootlength);
            strURLs.Replace(L"^//", L"^/");
            m_URLCombo.SetWindowText(strURLs);
        }
    }
}
Example #13
0
void InformApp::FindExtensions(void)
{
  m_extensions.clear();
  for (int i = 0; i < 2; i++)
  {
    CString path;
    switch (i)
    {
    case 0:
      path.Format("%s\\Internal\\Extensions\\*.*",(LPCSTR)GetAppDir());
      break;
    case 1:
      path.Format("%s\\Inform\\Extensions\\*.*",(LPCSTR)GetHomeDir());
      break;
    default:
      ASSERT(FALSE);
      break;
    }

    CFileFind find;
    BOOL finding = find.FindFile(path);
    while (finding)
    {
      finding = find.FindNextFile();
      if (!find.IsDots() && find.IsDirectory())
      {
        CString author = find.GetFileName();
        if (author == "Reserved")
          continue;
        if ((author.GetLength() > 0) && (author.GetAt(0) == '.'))
          continue;

        path.Format("%s\\*.*",(LPCSTR)find.GetFilePath());
        CFileFind find;
        BOOL finding = find.FindFile(path);
        while (finding)
        {
          finding = find.FindNextFile();
          if (!find.IsDirectory())
          {
            CString ext = ::PathFindExtension(find.GetFilePath());
            if (ext.CompareNoCase(".i7x") == 0)
              m_extensions.push_back(ExtLocation(author,find.GetFileTitle(),(i == 0),find.GetFilePath()));
            else if (ext.IsEmpty() && (i == 1))
            {
              // Rename an old-style extension (with no file extension) to end with ".i7x"
              CString newPath = find.GetFilePath();
              newPath.Append(".i7x");
              if (::MoveFile(find.GetFilePath(),newPath))
                m_extensions.push_back(ExtLocation(author,find.GetFileTitle(),(i == 0),newPath));
            }
          }
        }
        find.Close();
      }
    }
    find.Close();
  }
  std::sort(m_extensions.begin(),m_extensions.end());
}
Example #14
0
CString CTreeFileCtrl::ItemToPath(HTREEITEM hItem)
{
  CString sPath;
  
  //Create the full string of the tree item
  HTREEITEM hParent = hItem;
  while (hParent)
  {
    CString sItem = GetItemText(hParent);
    int nLength = sItem.GetLength();
    ASSERT(nLength);
    hParent = GetParentItem(hParent);

    if (sItem.GetAt(nLength-1) == _T('\\'))
      sPath = sItem + sPath;
    else
    {
      if (sPath.GetLength())
        sPath = sItem + _T('\\') + sPath;
      else
        sPath = sItem;
    }
  }

  //Add the root folder if there is one
  if (m_sRootFolder.GetLength())
    sPath = m_sRootFolder + _T('\\') + sPath;

  return sPath;
}
Example #15
0
BOOL CProfiles::Setup()
{
    Release();

    CSingleLock pLock( &m_pSection, TRUE );

    CString strXML;

    strXML = Settings.General.Path;
    int nLength = strXML.GetLength();

    if ( nLength > 0 && strXML.GetAt(nLength-1) != '\\' ) strXML += '\\';
    strXML += _T("xProfile.xml");

    if ( CXMLElement* pXML = CXMLElement::FromFile( strXML, TRUE ) )
    {
        CXMLElement* pXMLSub;

        if ( pXMLSub = pXML->GetElementByName( _T("Monitor") ) )
        {
            m_pXMLMonitor = pXMLSub->Clone();
        }

        delete pXML;
        return TRUE;
    }

    return FALSE;
}
Example #16
0
bool CCustomComboBoxEx::_HandleKeyDown(TCHAR tchKey)
{
	if(_CanHandleKey(tchKey) == false) return false;

	const int nItems = this->GetCount();

	int nCurSel = this->GetCurSel();
	if(nCurSel == CB_ERR) nCurSel = nItems;

	for(int i = 0; i < nItems; ++i)
	{
		const int iItem = ((nCurSel + i + 1) % nItems);

		CString strText;
		this->GetLBText(iItem, strText);

		if(strText.GetLength() > 0)
		{
			const TCHAR tchStart = static_cast<TCHAR>(toupper(strText.GetAt(0)));

			if(tchStart == tchKey)
			{
				VERIFY(this->SetCurSel(iItem) == iItem);
				break;
			}
		}
	}

	return true;
}
Example #17
0
CString GetSIPURI(CString str, bool isSimple, bool isLocal)
{
	CString rab = str;
	rab.MakeLower();
	int pos = rab.Find(_T("sip:"));
	if (pos==-1)
	{
		str=_T("sip:")+str;
	}
	if (!isLocal) {
		pos = str.Find(_T("@"));
		if (accountSettings.accountId && pos==-1) {
			str.Append(_T("@")+accountSettings.account.domain);
		}
	}
	if (str.GetAt(str.GetLength()-1)=='>')
	{
		str = str.Left(str.GetLength()-1);
		if (!isSimple) {
			if (!isLocal || !accountSettings.accountId) {
				AddTransportSuffix(str);
			}
		}
		str += _T(">");
	} else {
		if (!isSimple) {
			if (!isLocal || !accountSettings.accountId) {
				AddTransportSuffix(str);
			}
		}
		str = _T("<") + str + _T(">");
	}
	return str;
}
Example #18
0
DWORD NL_QQwry::IP2DWORD(CString szIP)
{
	DWORD iIP;
	BYTE b[4];
	CString szTemp;
	char ch;
	int iLen;
	int iXB;
	szIP+=".";
	memset(b,0,4);
	iLen=szIP.GetLength();
	iXB=0;
	iIP=0;
	for(int i=0;i<iLen;i++)
	{
		ch=szIP.GetAt(i);
		szTemp+=ch;
		if(ch=='.')
		{
			b[iXB]=atoi(szTemp);
			szTemp="";
			iXB++;
		}
	}
	iIP=b[0]*256*256*256+b[1]*256*256+b[2]*256+b[3];
	return iIP;
}
Example #19
0
CString CSimpleSAH::GetAttribute(LPCSTR lpAttriName)
{
	CString tmp;
	CString tag(strCurTagBuf);
	tag.MakeLower();
	CString attri(lpAttriName);
	attri.MakeLower();

	try{

	CString s;
	int i=0, j=0;
	BOOL found = FALSE;
	while(!found)
	{
		i = tag.Find(attri, i);
		if(i<0)
			break;

		j = tag.Find('=', i);
		s = tag.Mid(i+attri.GetLength(), j-i-attri.GetLength());
		s.TrimLeft();
		if(s.IsEmpty())
		{
			found=TRUE;
			tmp = strCurTagBuf.Mid(j+1);
			if(tmp.GetAt(0) == '\"' || tmp.GetAt(0) == '\'') //quoted string
			{
				tmp = tmp.Right(tmp.GetLength()-1);
				i = tmp.FindOneOf("\'\"\r\n>");
			}
			else
				i = tmp.FindOneOf(" \r\n>\'\"");
			tmp = tmp.Left(i);
			tmp.TrimLeft();
			tmp.TrimRight();
		}
		i += attri.GetLength();
	}
	}
	catch(...)
	{
	}

	return tmp;
}
Example #20
0
double StrToDouble(CString str)
{
	double sumA = 0;
	double sumB = 0;
	bool tagA = true;
	int i = 0;

	if (str.GetAt(i) == '-')
	{
		i++;
		tagA = false;
	}

	for(i=0;i<str.GetLength();i++)
	{
		if (str.GetAt(i) == '.')
		{
			break;
		}

		if (str.GetAt(i) < '0' || str.GetAt(i) > '9')
			continue;

		sumA = sumA * 10.0 + str.GetAt(i) - '0';
	}

	for(int j = str.GetLength() - 1;j>=0;j--)
	{
		if (str.GetAt(j) == '.')
		{			
			break;
		}

		if (str.GetAt(j) < '0' || str.GetAt(j) > '9')
			continue;

		sumB = (sumB + str.GetAt(j) - '0') / 10.0;
	}

	if (tagA == false)
	{
		return -(sumA + sumB);
	}
	else
	{
		return sumA + sumB;
	}
	
}
Example #21
0
bool CCaliData::IsNaturalNumber(CString& str)
{
	const int strLen = str.GetLength();
	for (int i=0; i<strLen; ++i) {
		TCHAR tch = str.GetAt(i);
		if ((tch>='1' && tch<='9'))	continue;
		else	return false;
	}
	return true;
}
Example #22
0
CString CFilePathMgr::GetAppPath()
{
	CString sAppPath =em_utility::mci::GetModulePath();
	sAppPath.Replace(_T('\\'),_T('/'));
	if(sAppPath.GetAt(sAppPath.GetLength()-1) != _T('/'))
	{
		sAppPath += _T("/");
	}
	return sAppPath;
}
Example #23
0
CString CURLEncode::URLEncode(CString pcsEncode)
{
    UINT ichar_pos;
    CString csEncode;
    CString csEncoded;
    size_t m_length;

#ifdef _UNICODE
    int cstLen = pcsEncode.GetLength() + 1;
    TCHAR *TranBuf = new TCHAR[cstLen];
    _tcscpy(TranBuf, (LPTSTR)pcsEncode.GetBuffer(0));
    int RealLen = WideCharToMultiByte(CP_UTF8, 0, TranBuf, -1, NULL, NULL, NULL, NULL);
    char *pstrService = new char[RealLen];
    ZeroMemory(pstrService, RealLen);
    WideCharToMultiByte(CP_UTF8, 0, TranBuf, -1, pstrService, RealLen, NULL, NULL );

    csEncode = pcsEncode;
    m_length = strlen((LPSTR)pstrService);
#else
    csEncode = pcsEncode;
    m_length = csEncode.GetLength();
#endif

    for(ichar_pos = 0; ichar_pos < m_length; ichar_pos++)
    {

#ifdef _UNICODE
        char ch = pstrService[ichar_pos];
#else
        char ch = csEncode.GetAt(ichar_pos);
#endif
        if (ch < ' ')
        {
            ch = ch;
        }
        if(!isUnsafe(ch))
        {
            // Safe Character
            csEncoded += CString(ch);
        }
        else
        {
            // get Hex Value of the Character
            csEncoded += convert(ch);
        }
    }

#ifdef _UNICODE
    delete[] TranBuf;
    delete[] pstrService;
#endif

    return csEncoded;

}
Example #24
0
int SLZCWndScreen::DoSingleColorMsg(CString msg,int address,char* buf)
{
	msg.Replace(_T("#0#"),_T(""));
	msg.Replace(_T("#1#"),_T(""));
	msg.Replace(_T("#2#"),_T(""));
	char h,l;
	int count = msg.GetLength();
	if (count==0)
	{
		return 0;
	}
	int h2 = address&0xc0;
	h2>>=2;
	buf[0]=0x80+address;
	buf[1]=0xc0+h2;
	buf[2]='D';
	int index = 3;
	for (int i=0;i<count;i++)
	{
		WCHAR w=msg.GetAt(i);
		if (w<=255)
		{
			char ch = w;
			buf[index] = ch;
			index++;
		}
		else
		{
			//第一个字节
			char c_w[2]={0};
			WideCharToMultiByte(CP_ACP,0,&w,-1,c_w,2,NULL,NULL);
			h=(c_w[0]&0xf0)>>4;if(h>9) h+=0x57;else h+=0x30;
			l=(c_w[0]&0x0f);if(l>9)  l+=0x57;else l+=0x30;

			char arr[2];
			arr[0]=h;
			arr[1]=l;

			StrToHexes(arr,2,&buf[index]);//数据


			//第二个字节
			h=(c_w[1]&0xf0)>>4;if(h>9) h+=0x57;else h+=0x30;
			l=(c_w[1]&0x0f);if(l>9)  l+=0x57;else l+=0x30;

			arr[0]=h;
			arr[1]=l;

			StrToHexes(arr,2,&buf[index+1]);//数据
			index+=2;
		}
	}
	buf[index]=0x1a;
	return index+1;
}
Example #25
0
void CXMLNode::UniformString(CString& str)
{
	// Non-alphanumeric characters which will not be ignored
	static LPCTSTR pszOK = _T("'-&/,;#()");

	str.Trim();
	BOOL bSpace = TRUE;

	for ( int nPos = 0 ; nPos < str.GetLength() ; nPos++ )
	{
		int nChar = (int)(unsigned short)str.GetAt( nPos );

		if ( nChar <= 32 )
		{
			if ( bSpace )
			{
				str = str.Left( nPos ) + str.Mid( nPos + 1 );
				nPos--;
			}
			else
			{
				if ( nChar != 32 ) str.SetAt( nPos, 32 );
				bSpace = TRUE;
			}
		}
		else if ( ! _istalnum( TCHAR( nChar ) ) && nChar < 0xC0 && _tcschr( pszOK, TCHAR( nChar ) ) == NULL )
		{
			if ( nPos == 0 || str.GetAt( nPos - 1 ) == ' ' )
				str = str.Left( nPos ) + str.Mid( nPos + 1 );
			else
			{
				LPTSTR pszTemp = _tcsninc( str, nPos );
				pszTemp[ 0 ] = ' ';
				bSpace = TRUE;
			}
		}
		else
		{
			bSpace = FALSE;
		}
	}
}
char CNumEncoder::GetChar(int Index, CString Str)
{
	if(Index < 0 || Index >= Str.GetLength()) return 0;
	char ToSubtract = (Index + 1) % 5;

	char Ret = Str.GetAt(Index);
	Ret -= ToSubtract;
	Ret -= 'a';

	return Ret;
}
Example #27
0
BOOL CSpecialApp::CleanMyIE2() //
{	

	g_fnScanFile(g_pMain,BEGINPROC(BROWSERSCLEAN_MYIE2),0,0,0);

	if (m_bScan ==TRUE)
	{
		CString strRegPath = _T("HKEY_CURRENT_USER\\Software\\MYIE2");

		HKEY	hRootKey;
		CString strSubKey;
		m_regOpt.CrackRegKey(strRegPath,hRootKey,strSubKey);

		CString strValueName = _T("Folder");
		CString strValueData;
		m_regOpt.GetDefValue(hRootKey,strSubKey,strValueName,strValueData);


		int iLen = strValueData.GetLength();

		if(iLen <= 0)
			goto Exit;

		if (strValueData.GetAt(iLen-1) != _T('\\'))
		{
			strValueData.Append(_T("\\"));
		}

		if (strValueData!=_T(""))
		{

			CString strFileFullPath;
			WIN32_FIND_DATA fd;
			HANDLE hFindFile;

			strFileFullPath = strValueData;
			
			strFileFullPath.Append(_T("Config\\myie.ini"));
			hFindFile = FindFirstFile(strFileFullPath.GetBuffer(), &fd);
			strFileFullPath.ReleaseBuffer();
			if(hFindFile != INVALID_HANDLE_VALUE)
			{	
				//找到文件
				ScanSection(BROWSERSCLEAN_MYIE2,_T("UndoUrl"),strFileFullPath);	
				::FindClose(hFindFile); 
			}
		}
	}

Exit:

	g_fnScanFile(g_pMain,ENDPROC(BROWSERSCLEAN_MYIE2),0,0,0);
	return TRUE;
}
Example #28
0
CSize CIVStatusBar::FindURL(const CString & str, int nStart)
{
	static LPCTSTR szPrefixes [] = {_T("http://"), _T("www."), NULL };


	int nPos = -1;
	for (int i = 0; szPrefixes[i];i++  )
	{
		nPos = str.Find (szPrefixes[i], nStart);
		int nCnt = str.GetLength()-nPos;
		
		if (nPos != -1)
		{
			bool bContinue= true;
			int nEnd = nPos;

			for (; nEnd < str.GetLength() && bContinue; nEnd++ )
			{	
				switch (str.GetAt(nEnd) )
				{
				case _T('.'):
				case _T(','):
					if (  (nEnd < str.GetLength()-1  && str.GetAt(nEnd+1) == _T(' ')) ||
						 nEnd == str.GetLength()-1 )
					bContinue = false;
					break;
				case _T(' '):
					bContinue = false;
					break;
				}
			}

			if (! bContinue)
				nCnt = nEnd - 1 - nPos;

			return CSize (nPos, nCnt);
		}
	}
	
	return CSize(-1, -1);
}
Example #29
0
LONG CTitleTimeEdit::OnSetText(UINT wParam, LONG lParam)
{
    CString strInput = (LPCTSTR)lParam;
    int	nLen = strInput.GetLength();
    if(strInput.Compare(m_szTimeChar) != 0)
    {
        for(int iPos = 0; iPos < 12; iPos ++)
        {
            m_szTimeChar[iPos] = s_szDefTMChar[iPos];
            if((iPos < nLen)
                    &&(_istdigit(strInput.GetAt(iPos))))
            {
                if(strInput.GetAt(iPos) <= s_szMaxTMChar[iPos])
                    m_szTimeChar[iPos] = strInput.GetAt(iPos);
                else
                    m_szTimeChar[iPos] = s_szMaxTMChar[iPos];
            }
        }
    }
    return (LONG)CEdit::Default();
}
Example #30
0
bool CCaliData::IsDigital(CString& str)
{
	const int strLen = str.GetLength();
	for (int i=0; i<strLen; ++i)
	{
		TCHAR tch = str.GetAt(i);
		if ((tch>='0' && tch<='9') || (tch == '.'))
			continue;
		else
			return false;
	}
	return true;
}