Ejemplo n.º 1
0
void CFileView::SetFileModifiedFlag(BOOL bFlag)
{
	if (m_bModifiedFlag == bFlag)
	{
		return;
	}

	m_bModifiedFlag = bFlag;
	HTREEITEM hItem = m_wndFileView.GetSelectedItem();
	HTREEITEM hParentItem = hItem;
	while (m_wndFileView.GetParentItem(hParentItem))
	{
		hParentItem = m_wndFileView.GetParentItem(hParentItem);
	}
	CString strText = m_wndFileView.GetItemText(hParentItem);

	if (bFlag)
	{
		strText.AppendChar('*');
	} 
	else
	{
		strText.Delete(strText.GetLength() - 1);
	}
	m_wndFileView.SetItemText(hParentItem, strText);
}
Ejemplo n.º 2
0
BOOL CNNTPConnection::Group(LPCTSTR pszGroup, int &nArticles)
{
	if(!m_bConnected)
		return FALSE;
	
	CString strCmd = _T("GROUP ");
	strCmd += pszGroup;
	strCmd += _T("\r\n");

	if(!m_nntp.Send(strCmd, strCmd.GetLength()))
	{
		m_strErrorMsg = FuncGetStringFromIDS("<%IDS_News_3%>");//<%IDS_News_3%>_T("дÊý¾Ý´íÎó")
		return FALSE;
	}

	CString strInfo = _T("");
	int nRes = CommandResponse(strInfo);
	if(nRes != 2)
	{
		m_strErrorMsg = strInfo;
		return FALSE;
	}

	strInfo.Delete(0, 3);
	nArticles = atoi(strInfo);
	return TRUE;
}
Ejemplo n.º 3
0
bool CPinInfoWnd::OnActivate()
{
	DWORD dwStyle = WS_VISIBLE|WS_CHILD|WS_TABSTOP;

	CPoint p(10, 10);

	m_pin_static.Create(_T("Pin:"), dwStyle, CRect(p + CPoint(0, 3), CSize(30, m_fontheight)), this);
	m_pin_combo.Create(dwStyle|CBS_DROPDOWNLIST, CRect(p + CPoint(30, 0), CSize(450, 200)), this, IDC_PP_COMBO1);
	BeginEnumPins(m_pBF, pEP, pPin) {
		CPinInfo pi;
		if (FAILED(pPin->QueryPinInfo(&pi))) {
			continue;
		}
		CString str = CString(pi.achName);
		if (!str.Find(_T("Apple"))) {
			str.Delete(0,1);
		}
		CString dir = _T("[?] ");
		if (pi.dir == PINDIR_INPUT) {
			dir = _T("[IN] ");
		} else if (pi.dir == PINDIR_OUTPUT) {
			dir = _T("[OUT] ");
		}
		m_pin_combo.SetItemDataPtr(m_pin_combo.AddString(dir + str), pPin);
	}
void tScriptState::ParseCommand(CString& s, tCommand& cmd, ULONG step, bool& bSilent)
{
    size_t len = 0;
    int i, selected = -1;
    const char *token;
    tCommandId cmdId = cmdInvalid;
    cmd.step =  step;
    cmd.line = currentLine;
    cmd.lineDot = ++currentDot;
    s.MakeLower();
    for (i = 0; i < ELEMENTS_IN(commands); ++i)
    {
        if (s.Find(commands[i].token) == 0 && len < strlen(commands[i].token))
        {
            cmdId = commands[i].cmd;
            len = strlen(commands[i].token);
            token = commands[i].token;
            selected = i;
        }
    }
    cmd.cmdId = cmdId;
    if (cmdId != cmdInvalid)
    {
        s.Delete(0, len);
        // get parameters
        if (FillParameters(s, cmd, commands[selected]))
        {
            if (!bSilent)
            {
                s.Format("%04d.%d(%04d) Command %s", cmd.line, cmd.lineDot, cmd.step, (LPCSTR)cmd.Description());
                LogTestFlow("%s\n", (LPCSTR)s);
            }
        }
    }
}
Ejemplo n.º 5
0
CString CGetEnvPath::CombinationPath(const CString& strLeft, 
    const CString& strMiddle, 
    const CString& strRight)
{
    CString strResult;
    const int nCount = 3;
    const CString* pStr[nCount] = 
        { &strLeft, &strMiddle, &strRight};

    for (int i = 0; i < nCount; i++)
    {
        const CString& str = *pStr[i];

        if (strResult.GetLength() <= 0)
            strResult += str;
        else
        {
            if (str.GetLength() <= 0)
                continue;

            if (strResult[strResult.GetLength() - 1] == TEXT('\\'))
                strResult.Delete(strResult.GetLength() - 1);

            if (str[0] != TEXT('\\'))
            {
                strResult += TEXT('\\');
            }

            strResult += str;
        }
    }

    return strResult;
}
Ejemplo n.º 6
0
void CNumEdit::OnChar( UINT nChar, UINT nRepCnt, UINT nFlags )
{
    // TODO: Add your message handler code here and/or call default
    CString ss;
    char ch = char(nChar);
    GetWindowText(ss);

    if(!isdigit(ch))
    {
        if(ch == '.')
        {
            if(ss.Find('.') != -1)
            return;
        }
        else
        {
            if(ch == '/b')
            {
            ; 
            }
            else if (ch == 0x08)
            {
                ss.Delete(ss.GetLength()-1);
            }
            else
                return;
        }
    }
    CEdit::OnChar(nChar, nRepCnt, nFlags);
}
Ejemplo n.º 7
0
inline void StringToArray(LPCTSTR text, ArrayT & array, LPCTSTR separator = _T(""), bool trimSpaces = true)
{
    CString search = text;
    int seplen = CString(separator).GetLength();
    while (true)
    {
        int idx = search.Find(separator);
        if (idx == -1)
        {
            if (trimSpaces)
            {
                search.TrimLeft();
                search.TrimRight();
            }
            if (!search.IsEmpty())
                array.Add(search);
            break;
        }
        CString part = search.Left(idx);
        search.Delete(0, idx + seplen);
        if (trimSpaces)
        {
            part.TrimLeft();
            part.TrimRight();
        }
        if (!part.IsEmpty())
            array.Add(part);
    }
}
Ejemplo n.º 8
0
CSVNTrace::CSVNTrace
    ( const wchar_t* name
    , int lineNo
    , const wchar_t* line
    , const char* svnPath)
    : id (InterlockedIncrement (&counter))
    , threadID (GetCurrentThreadId())
{
    if (!CTraceToOutputDebugString::Active())
        return;

    CString svnAPI = line;
    int assignPos = svnAPI.Find ('=');
    if (assignPos > 0)
        svnAPI.Delete (0, assignPos+1);

    svnAPI = svnAPI.TrimLeft().SpanExcluding (_T(" \r\n\t("));
    CString path;
    if (svnPath)
        path = CString (_T("Path=")) + CUnicodeUtils::GetUnicode(svnPath);

    CTraceToOutputDebugString::Instance()(_T("#%d Thread:%d %s(line %d) %s %s\n")
             , id
             , threadID
             , name
             , lineNo
             , (const wchar_t*)svnAPI
             , (const wchar_t*)path);
}
Ejemplo n.º 9
0
bool MyUPnP::GetDescription()
{
	if(!Valid())return false;
	CString post, host, addr;
	int port = 0;
	addr = NGetAddressFromUrl(m_description, post, host, port);
	if(addr.IsEmpty())return false;
	CString request = CString(_T("GET ")) + post + _T(" HTTP/1.1\r\nHOST: ") + host + _T("\r\nACCEPT-LANGUAGE: en\r\n\r\n");
	CString response;
	if (!SOAP_action(addr, (uint16)port, request, response)) return false;
	CString result;
	if (!parseHTTPResponse(response, result)) return false;

	m_friendlyname = getProperty(result, _T("friendlyName"));
	m_modelname = getProperty(result, _T("modelName"));
	m_baseurl = getProperty(result, _T("URLBase"));
	if(m_baseurl.IsEmpty())m_baseurl = CString(_T("http://")) + host + _T("/");
	if(m_baseurl[m_baseurl.GetLength() - 1]!='/')m_baseurl += _T("/");
	
	CString serviceType = _T("<serviceType>") + m_name + _T("</serviceType>");
	int pos = result.Find(serviceType);
	if (pos >= 0) {
		result.Delete(0, pos + serviceType.GetLength());
		pos = result.Find(_T("</service>"));
		if (pos >= 0) {
			result = result.Mid(0, pos);
			m_controlurl = getProperty(result, _T("controlURL"));
			if (!m_controlurl.IsEmpty() && m_controlurl[0] == '/') {
				m_controlurl = m_baseurl + m_controlurl.Mid(1);
			}
		}
	}

	return isComplete();
}
Ejemplo n.º 10
0
// public functions
bool CYYApiMgr::Init()
{
	ASSERT(g_pYYExApi==NULL);

	unsigned int nError = yy_e_unknown;
	CString cmdline = ::GetCommandLine();
	int blankIdx = cmdline.Find(_T(' '));
	cmdline.Delete(0, blankIdx + 1);
	nError = GetYYAPIEx(&g_pYYExApi, cmdline.GetBuffer());
	if(g_pYYExApi == NULL)
	{
		// clear
		Exit();
		return false;
	}

	// TOCONFIRM:这个在用的时候必须AddRef!!!
	g_pYYExApi->AddRef();
	nError = g_pYYExApi->Initialize();
	if (nError != yy_success)
	{
		// clear
		Exit();
		return false;
	}

	return true;
}
Ejemplo n.º 11
0
BOOL CCreepingLineDoc::OnOpenDocument(LPCTSTR lpszPathName) 
{
	if (!CDocument::OnOpenDocument(lpszPathName))
		return FALSE;

	m_line.InitDefault();
	BOOL bLoaded = m_line.Load( lpszPathName );
	if( !bLoaded )
	{
		MessageBox(NULL,_T("Can't open file"), _T("Ok"), MB_OK);
		return FALSE;
	}

	m_line_orig = m_line;

	// due to error into MFC code during SetTitle of line more than _MAX_PATH we reduce it to _MAX_PATH
	CString smallTitle = m_line.m_strText;
	int smallTitleLength = smallTitle.GetLength();
	if (smallTitleLength > _MAX_PATH)
	{
		smallTitle.Delete(_MAX_PATH, smallTitleLength-_MAX_PATH);
	}
	SetTitle( smallTitle );

	return TRUE;
}
Ejemplo n.º 12
0
BOOL CYYApiMgr::Rename(CString nick)
{
	if (g_pYYExApi == NULL)
	{
		return FALSE;
	}

	yy::IUserEx* pUser = g_pYYExApi->GetUser();
	if (pUser == NULL)
	{
		return FALSE;
	}

	if (nick.GetLength() > max_nick_length)
	{
		nick.Delete(max_nick_length, nick.GetLength()-max_nick_length);
	}

	char name[256] = {0};
	strcpy(name, CT2A(nick, CP_UTF8));
	unsigned int nError = pUser->Rename(name);
	if (nError != yy_success)
	{
		return FALSE;
	}

	return TRUE;
}
Ejemplo n.º 13
0
Archivo: Loc.cpp Proyecto: IcyX/bote
/// Funktion gibt einen String zurück, der in einer StringTable steht.
CString CLoc::GetString(const CString& key, BOOLEAN forceBigStarting, const CString& subString1, const CString& subString2)
{
	CString returnString;
	if (!m_StringTable.Lookup(key, returnString))
		return key + " is missing";

	// Haben wir subStrings übergeben, so müssen wir die § Zeichen ersetzen
	if (subString1 != "")
	{
		// hier ein bisl umständlich, aber sonst würde er alle "§" Zeichen ersetzen
		int pos = returnString.FindOneOf("§");
		if (pos != -1)
		{
			returnString.Delete(pos);
			returnString.Insert(pos,subString1);
			if (subString2 != "")
				returnString.Replace("§",subString2);
		}
	}
	if (forceBigStarting)
	{
		CString upper = (CString)returnString.GetAt(0);
		returnString.SetAt(0, upper.MakeUpper().GetAt(0));
	}
	return returnString;
}
Ejemplo n.º 14
0
bool CMimeParser::ProcessMultipart(CString RawData, const CString& Boundary, CVectorTable<CStringTable>& Fields) {
  //cout << "expected boundary: [" << "--" + Boundary << "]" << endl;	
  CString OneLine; RawData.ExtractLine(&OneLine);
  //cout << "   found boundary: [" << OneLine << "]" << endl;
  CString PrefixedBoundary;
  while (OneLine.GetLength()) {
    //cout << OneLine << endl;
    PrefixedBoundary = g_strDashDash;
    PrefixedBoundary.Append(Boundary);
    if (OneLine == PrefixedBoundary) {
      CStringTable Table;
      CString Name, Value;
      RawData.ExtractLine(&OneLine);
      while (OneLine.GetLength()) {
        if (ParseLine(OneLine, Name, Value, Table)) {
          //Fields.Add(Name, Table);
          // _L_DEBUG(3, cout << "---------------------" << endl);
          // _L_DEBUG(3, cout << "Content disposition: " << Table.GetValue("Content-Disposition") << endl);
          // _L_DEBUG(3, cout << "               Name: " << Table.GetValue("name") << endl);
          // _L_DEBUG(3, cout << "       Content type: " << Table.GetValue("Content-type") << endl);
          // _L_DEBUG(3, cout << "           Filename: " << Table.GetValue("Filename") << endl);
        } else return false;
        RawData.ExtractLine(&OneLine);
      }            
      int NextBoundaryPosition = RawData.Pos(PrefixedBoundary);
      if (NextBoundaryPosition == -1) NextBoundaryPosition = RawData.GetLength();
      Table.Add(g_strValue, CString(RawData.GetBuffer(), NextBoundaryPosition-2));
      Fields.Add(Table.GetValue(g_strName), Table);
      RawData.Delete(0, NextBoundaryPosition);
      // _L_DEBUG(3, cout << "              Value: " << Table.GetValue(g_strValue) << endl);
      RawData.ExtractLine(&OneLine);
    } else return false;
  }
  return true;
}
Ejemplo n.º 15
0
CString CPath::ExtractDrive(CString sPath, CString sSplitter /* = "\\" */)
{
	// Declare variables
	int iPos;
	DWORD dwDriveType;

	// Search for first backslash
	iPos = sPath.Find(sSplitter);

	if (iPos != -1)
	{
		// Delete rest of path
		sPath.Delete(iPos, sPath.GetLength() - iPos);
	}

	// Check if the path is a valid drive
	sPath += _T("\\");
	dwDriveType = GetDriveType(sPath);
	if ((dwDriveType == DRIVE_UNKNOWN) || (dwDriveType == DRIVE_NO_ROOT_DIR))
	{
		return _T("");
	}

	// Return the drive
	return sPath;
}
Ejemplo n.º 16
0
void CAction::GetKeyElement(CString &s,int &type,int &key)
{
    // формат примерно такой "d(ff)u(ff)"
    if(s.GetLength()<4) {
        s.Empty();
        return;
    }
    if(s.GetAt(1)!=_T('(')) {
        s.Empty();
        return;
    }
    type=-1;
    if(s.GetAt(0)==_T('d'))type=0;
    if(s.GetAt(0)==_T('u'))type=1;
    if(type==-1) {
        s.Empty();
        return;
    }
    int end=s.Find(_T(")"));
    if(end==-1) {
        s.Empty();
        return;
    }
    key=_tstoi(s.Mid(2,end-2));
    s.Delete(0,end+1);
}
Ejemplo n.º 17
0
CString GravadorControllerDlg::DebugDboException(CDBException *e, CString cOrigin, int nNivel)
{
	// procura pelo código do erro. Extrai de  "State:%s,Native:%ld,Origin:%s"
	int nPos;
	nPos = e->m_strStateNativeOrigin.Find(',');	
	CString cErr;
	cErr = e->m_strStateNativeOrigin.Left(nPos); // State:%s

	CString cException;
	e->GetErrorMessage(cException.GetBuffer(1024), cException.GetAllocLength());
	e->Delete(); // lembrar que não precisa apagar fora dessa rotina.
	cException.ReleaseBuffer();

	// acrescenta a rotina de origem, a descrição e o código do erro.
	cException = cOrigin + cException;
	cException = cException + cErr;

	m_debugLog.Log(LOG_ERROR, cException);
	MessageBox(cException, _T("ERRO"), MB_OK | MB_ICONERROR);

	// devolve o código do erro
	cErr.Delete(0, 6); // aqui só fica o "%s"

	return cErr;
}
Ejemplo n.º 18
0
void CCaliData::EraseZeroPlus(CString& str)  
{  
	int strLen = str.GetLength();
	int pos= str.Find(_T("E+")); 
	if (pos+5==strLen) //X.XXXe+000
		str.Delete(pos+2);
} 
Ejemplo n.º 19
0
CString CPath::StripFileExtension(CString sPath)
{
	// Declare variables
	int iPos;

	// Now search for the last dot
	for (int i = sPath.GetLength(); i > 0; i--)
	{
		iPos = sPath.Find(_T("."), sPath.GetLength()-(sPath.GetLength()-i));
		// If we found them, delete last piece
		if (iPos != -1)
		{
			sPath.Delete(iPos, sPath.GetLength() - i);
			return sPath;
		}

		// If it is a slash, we should not strip this extension anymore
		if (sPath.Find(_T("\\"), sPath.GetLength()-(sPath.GetLength()-i)) != -1)
			return sPath;
		if (sPath.Find(_T("\\"), sPath.GetLength()-(sPath.GetLength()-i)) != -1)
			return sPath;
	}

	// If we not found, we are already dealing with path
	return sPath;
}
Ejemplo n.º 20
0
CString CPath::ExtractFileExtension(CString sPath)
{
	// Declare variables
	int iPos;

	// Now search for the last dot
	for (int i = sPath.GetLength(); i > 0; i--)
	{
		iPos = sPath.Find(_T("."), sPath.GetLength()-(sPath.GetLength()-i));
		// If we found them, delete last piece
		if (iPos != -1)
		{
			sPath.Delete(0, iPos);
			return sPath;
		}

		// If it is a slash, we should not use this extension anymore
		if (sPath.Find(_T("\\"), sPath.GetLength()-(sPath.GetLength()-i)) != -1)
			return _T("");
		if (sPath.Find(_T("\\"), sPath.GetLength()-(sPath.GetLength()-i)) != -1)
			return _T("");
	}

	// If we not found, no extension is available
	return _T("");
}
Ejemplo n.º 21
0
//store the value of edit
HRESULT CTryData4Dlg::OnFinishEdit(IHTMLElement* pElement)
{
	if(m_State == RUNNING) return S_OK;

	CString sel = this->GetAttribute(pElement,m_elemTypes[5]);
	if(sel.IsEmpty() || (sel.Find("EDIT") != 0))
		return S_OK;

	CString selid = this->GetAttribute(pElement,m_elemTypes[2]);
	if(selid.IsEmpty())
		return S_OK;

	sel = this->GetAttribute(pElement,m_elemTypes[1]); 
	g_msTemp.SetAt(selid,sel);
	while(sel.GetLength() > 0){
		if(sel[0] != ' ')
			break;
		sel.Delete(0);
	}
	if(selid[0] == 'Z')
	{
		int uid = atoi(selid.Right(selid.GetLength()-1));
		
		RESDATA m;
		m.rResult = atof(sel);
		m.rbResult = true;
		g_Data.SetRecord(uid,m);
	}
    return S_OK;
}
Ejemplo n.º 22
0
BOOL CommonStrMethod::CreateFile(CString strFile)
{
	CString strFileName = GetNameFromAbsName(strFile);
	CString strPath = GetPathFromAbsName(strFile);
	if(!IsAbsPath(strPath))
	{
		if(strPath.GetLength() > 0)
		{
			if(strPath.GetAt(0) == _T('\\') || strPath.GetAt(0) == _T('/'))
			{
				strPath.Delete(0);
			}
		}
		strPath = GetModuleDir() + strPath;
	}
	if(!CreatePath(strPath))
	{
		return FALSE;
	}
	HANDLE hFile = ::CreateFile(strPath + strFileName, GENERIC_ALL, FILE_SHARE_READ,
		NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
	if(hFile == INVALID_HANDLE_VALUE)
	{
		return FALSE;
	}

	::CloseHandle(hFile);

	return TRUE;
}
Ejemplo n.º 23
0
void CAction::operator = (CString action)
{
    if(action.Find(_T("standart("))==0)	{
        m_Type=0;
        goto next;
    }
    if(action.Find(_T("start("))==0)	{
        m_Type=1;
        goto next;
    }
    if(action.Find(_T("text("))==0)		{
        m_Type=2;
        goto next;
    }
    if(action.Find(_T("key("))==0)		{
        m_Type=3;
        goto next;
    }
    if(action.Find(_T("message("))==0)	{
        m_Type=4;
        goto next;
    }
next:
    int i=0;
    for(i=0; i<3; i++)
        m_Param[i].Empty();

    int start=action.Find(_T("("));
    if(start==-1)return;
    action.Delete(0,start+1);
    if(action.GetLength()<=0)return;
    if(action.GetAt(action.GetLength()-1)==_T(')'))
        action.SetAt(action.GetLength()-1,_T(','));
    else
        return;
    for(i=0; i<3; i++)
    {
        int end=action.Find(_T(","));
        if(end==-1)break;
        m_Param[i]=FromSafe(action.Left(end));
        action.Delete(0,end+1);
    }

    TRACE(_T("[0] ")+m_Param[0]+_T("\n"));
    TRACE(_T("[1] ")+m_Param[1]+_T("\n"));
    TRACE(_T("[2] ")+m_Param[2]+_T("\n"));
}
Ejemplo n.º 24
0
BOOL CWizardEncWpa::OnInitDialog() 
{
	CNGWizardPage::OnInitDialog();
	
	// TODO: Add extra initialization here
	CNGWizard* pWizardSheet = (CNGWizard*)m_pParentSheet;
	CString strRadiusServer;
	char m_cRadiusServer[4];

//	memcpy(strRadiusServer, pWizardSheet->m_pWizardLogin->m_cRadiusServer, sizeof(strRadiusServer));
	strRadiusServer = pWizardSheet->m_pWizardLogin->m_cRadiusServer;
	
	if (strRadiusServer.IsEmpty() == false)
	{
		for(int i = 0; i < 4; i++)
		{
			CString StrTemp;

			int pos = strRadiusServer.Find('.',0);
			if ( pos != -1 )
				StrTemp = strRadiusServer.Left(pos);
			else
				StrTemp = strRadiusServer;

			int tt;
			tt = atoi(StrTemp);
			m_cRadiusServer[i] = (char)tt;
			strRadiusServer.Delete(0,pos+1);
		}
		m_ctrlRadiusServer.SetAddress(m_cRadiusServer[0],
									  m_cRadiusServer[1],
									  m_cRadiusServer[2],
									  m_cRadiusServer[3]);
	}

	switch(pWizardSheet->m_pWizardLogin->m_iEncryption)
	{
	case ENCRYPTION_TKIP:
		m_iWzEncryptionWpa = TKIP;
		break;
	case ENCRYPTION_AES_CCM:
		m_iWzEncryptionWpa = AES;
		break;
	case ENCRYPTION_DISABLED:
	case ENCRYPTION_WEP:
	case ENCRYPTION_AES_OCB:
	case ENCRYPTION_CKIP:
	case ENCRYPTION_AUTO:
		m_iWzEncryptionWpa = TKIP;
		break;
	}

	UpdateData(false);
	
	((CEdit*)GetDlgItem(IDC_EDIT_WZKEY_WPA))->SetLimitText(64);

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
void CDuyetFile::ApproveFolderToList(const TCHAR *strPath)
{
	ClearList();

	TCHAR strPathFileData[MAX_PATH] = {0};

	GetCurrentDirectory(MAX_PATH, strPathFileData);
	StringCchCat(strPathFileData, MAX_PATH, _T("\\danhsach.ini"));
	
	// UTF16-LE BOM(FFFE)
	WORD wBOM = 0xFEFF;
	DWORD NumberOfBytesWritten;

	HANDLE hFileOut = CreateFile(strPathFileData, FILE_WRITE_DATA, 0,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL, NULL);
	if(INVALID_HANDLE_VALUE == hFileOut)
	{
		AfxMessageBox(_T("Không thể tạo file"), MB_ICONSTOP);
		return;
	}
	//write unicode.
	::WriteFile(hFileOut, &wBOM, sizeof(WORD), &NumberOfBytesWritten, NULL);
	TCHAR strTemp[MAX_PATH] = {0};
	StringCchCopy(strTemp, MAX_PATH, strPath);
	CString temp = strPath;
	temp.Delete(wcslen(temp) - 2, 2);
	int iIndex = (int)wcslen(temp);
	for(; iIndex >= 0 ; iIndex--)
	{
		if(temp[iIndex] == L'\\')
		{
			break;
		}
	}
	temp.Delete(iIndex + 1,(int)wcslen(temp) - iIndex +1 );
	//FormatPath(temp);
	StringCchCopy(strRootPath, MAX_PATH, temp);

	if(ApproveFolder(strPath, &hFileOut))
	{
		
		AfxMessageBox(_T("Duyệt file hoàn tất"), MB_ICONINFORMATION);
	}
	else
		AfxMessageBox(_T("Duyệt file thất bại"), MB_ICONSTOP);
	CloseHandle(hFileOut);
}
CString CMyPath::TransferSourcePath( LPCTSTR strSource, LPCTSTR strDest, LPCTSTR strFileName )
{
	CString strPath = strFileName;
	strPath.Delete(0, lstrlen(strSource));
	strPath.Insert(0, strDest);

	return strPath;
}
Ejemplo n.º 27
0
CString CUpdate::toCString(){
	CString strResult;
	for(auto it = mapValue.begin();it != mapValue.end();it++){
		strResult = strResult + it->first + "=" + it->second.strValue + ",";
	}
	strResult.Delete(strResult.GetLength() - 1,1);
	return strResult;
}
Ejemplo n.º 28
0
// fnSplitColours - this will take a CString encoded colour code (RGB), split and convert to integers:
bool CFusicCartsDlg::fnSplitColours(CString strColourCode, int& intRed, int& intGreen, int& intBlue)
{
	CString strTemp;
	//make sure that the string is 9 chars long:
	if(strColourCode.GetLength() != 9)
	{
		return false;
	}
	//get the red portion of the colour code:
	strTemp = strColourCode.Left(3);

	//convert to an int:
	intRed = atoi(strTemp.GetBuffer());
	//clear memory:
	strTemp.ReleaseBuffer();

	//erase the first 3 number as we have used them:
	strColourCode.Delete(0,3);
	//erase the temp string:
	strTemp.Empty();

	//get the green portion of the colour code:
	strTemp = strColourCode.Left(3);

	//convert to int:
	intGreen = atoi(strTemp.GetBuffer());

	//clear memory:
	strTemp.ReleaseBuffer();

	//erase the next 3 number again, just leaving us with the blue colour:
	strColourCode.Delete(0, 3);
	//erase the temp string:
	strTemp.Empty();

	//get the blue bit:
	strTemp = strColourCode.Left(3);

	//convert to int:
	intBlue = atoi(strTemp.GetBuffer());
	//clear RAM:
	strTemp.ReleaseBuffer();


	return true;
}
Ejemplo n.º 29
0
int RDOEditorMainFrame::getIntegerAfterWord( const CString& str, const CString& word ) const
{
	int res = -1;
	int pos = str.Find( word );
	if ( pos != -1 ) {
		CString s = str;
		s.Delete( 0, pos + word.GetLength() );
		s.TrimLeft();
		int i;
		for ( i = 0; i < s.GetLength(); i++ ) {
			if ( s[i] == ' ' ) break;
		}
		s.Delete( i, s.GetLength() - i );
		s.TrimRight();
		res = strtol( s, NULL, 10 );
	}
	return res;
}
Ejemplo n.º 30
0
Archivo: XUtil.hpp Proyecto: Sumxx/XUI
		XResult RemoveLastSplit( CString& path,BOOL slash/*=UseSlash*/ )
		{
			while ( path.GetLength()!=0 && 
				path[path.GetLength()-1] == SplitChar(slash))
			{
				path.Delete(path.GetLength()-1,1);
			}
			return XResult_OK;
		}