Example #1
0
BOOL CommandLine::IsSwitch(const CString & strParameterString,
	CString & strSwitchName,
	CString & strSwitchValue)
{
	strSwitchName.Empty();
	strSwitchValue.Empty();

	CString strPrefix = kPrefix;
	if (strParameterString.Find(strPrefix) != 0)
		return FALSE;

	const INT nSwitchStart = strPrefix.GetLength();
	const INT nEqualsPosition = strParameterString.Find(
		kDelimeter, nSwitchStart);

	if (nEqualsPosition == -1) 
	{
		strSwitchName = strParameterString.Mid(nSwitchStart);
	} 
	else 
	{
		strSwitchName = strParameterString.Mid(
			nSwitchStart, nEqualsPosition - nSwitchStart);
		strSwitchValue = strParameterString.Mid(nEqualsPosition + 1);
	}

	strSwitchName.MakeLower();

	return TRUE;
}
Example #2
0
CString CDlgPreAlbEntrega::GetTipoMov()
{
	CString strTipoMov;
	CConcepto rsConcepto(m_db);

	strTipoMov.Empty();

	rsConcepto.m_strSort = "CONCEPTO";
	rsConcepto.m_strFilter = "CONCEPTO LIKE 'AL1%'";
	if (!rsConcepto.Open(CRecordset::dynaset))
	{
		AfxMessageBox(IDC_ERROR_BD);
		return strTipoMov;
	}

	// Si el almacén no se encuentra salimos reseteando el campo
	if (rsConcepto.m_CONCEPTO.IsEmpty())
		strTipoMov.Empty();
	else
		strTipoMov = rsConcepto.m_CONCEPTO.Trim();

	rsConcepto.Close();

	return strTipoMov;
}
void CUSB30Device::OnCbOpenDev(CString &info)
{
	CCyUSBDevice *pUSBDevice = m_pUSBDevice;

	CString csBuf;
	pUSBDevice->Open(0);
	info = pUSBDevice->FriendlyName;
	csBuf.Format(_T("; 设备PID:0x%04X; "), pUSBDevice->ProductID);
	info += csBuf;

	csBuf.Empty();
	csBuf.Format(_T("设备VID:0x%04X; "), pUSBDevice->VendorID);

	info += csBuf;
	csBuf.Empty();

	if (pUSBDevice->bSuperSpeed)  
	{
		csBuf = _T("设备类型:USB3.0超速设备");
	}
	else if (pUSBDevice->bHighSpeed) 
	{
		csBuf = _T("设备类型:USB2.0高速设备");
	}
	else 
	{
		csBuf = _T("设备类型:USB1.1全速设备");
	}
	info += csBuf;
	//WriteInfoTxt(info);

	//pUSBDevice->Close();
}
Example #4
0
void CServerWnd::OnBnClickedAddserver()
{
	CString serveraddr;
	if (!GetDlgItem(IDC_IPADDRESS)->GetWindowTextLength()){
		AfxMessageBox(GetResString(IDS_SRV_ADDR));
		return;
	}
	else
		GetDlgItem(IDC_IPADDRESS)->GetWindowText(serveraddr);

	uint16 uPort = 0;
	if (_tcsncmp(serveraddr, _T("ed2k://"), 7) == 0){
		CED2KLink* pLink = NULL;
		try{
			pLink = CED2KLink::CreateLinkFromUrl(serveraddr);
			serveraddr.Empty();
			if (pLink && pLink->GetKind() == CED2KLink::kServer){
				CED2KServerLink* pServerLink = pLink->GetServerLink();
				if (pServerLink){
					serveraddr = pServerLink->GetAddress();
					uPort = pServerLink->GetPort();
					SetDlgItemText(IDC_IPADDRESS, serveraddr);
					SetDlgItemInt(IDC_SPORT, uPort, FALSE);
				}
			}
		}
		catch(CString strError){
			AfxMessageBox(strError);
			serveraddr.Empty();
		}
		delete pLink;
	}
	else{
		if (!GetDlgItem(IDC_SPORT)->GetWindowTextLength()){
			AfxMessageBox(GetResString(IDS_SRV_PORT));
			return;
		}

		BOOL bTranslated = FALSE;
		uPort = (uint16)GetDlgItemInt(IDC_SPORT, &bTranslated, FALSE);
		if (!bTranslated){
			AfxMessageBox(GetResString(IDS_SRV_PORT));
			return;
		}
	}

	if (serveraddr.IsEmpty() || uPort == 0){
		AfxMessageBox(GetResString(IDS_SRV_ADDR));
		return;
	}

	CString strServerName;
	GetDlgItem(IDC_SNAME)->GetWindowText(strServerName);

	AddServer(uPort, serveraddr, strServerName);
}
Example #5
0
LRESULT GBMapView::OnMapInfo(WPARAM wParam, LPARAM lParam)
{
  u8 *colors = (u8 *)lParam;
  mapViewZoom.setColors(colors);

  int x = (int)(wParam & 0xffff);
  int y = (int)(wParam >> 16);

  CString buffer;
  buffer.Format("(%d,%d)", x, y);
  GetDlgItem(IDC_XY)->SetWindowText(buffer);

  u32 address = GetClickAddress(x,y);
  buffer.Format("0x%08X", address);
  GetDlgItem(IDC_ADDRESS)->SetWindowText(buffer);

  u8 attrs = 0;

  u8 tile = gbMemoryMap[9][address & 0xfff];
  if(gbCgbMode) {
    attrs = gbVram[0x2000 + address - 0x8000];
    tile = gbVram[address & 0x1fff];
  }

  if(bank == 1) {
    if(tile > 128) tile -= 128;
    else tile += 128;
  }

  buffer.Format("%d", tile);
  GetDlgItem(IDC_TILE_NUM)->SetWindowText(buffer);

  buffer.Empty();
  buffer += attrs & 0x20 ? 'H' : '-';
  buffer += attrs & 0x40 ? 'V' : '-';
  GetDlgItem(IDC_FLIP)->SetWindowText(buffer);

  if(gbCgbMode) {
    buffer.Format("%d", (attrs & 7));
  } else
    buffer = "---";
  GetDlgItem(IDC_PALETTE_NUM)->SetWindowText(buffer);

  buffer.Empty();
  if(gbCgbMode)
    buffer += attrs & 0x80 ? 'P' : '-';
  else
    buffer += '-';
  GetDlgItem(IDC_PRIORITY)->SetWindowText(buffer);

  return TRUE;
}
Example #6
0
bool CAddDevice::CheckONVIF()
{
	USES_CONVERSION;
	bool bResult = false;
	vector<NODEITEM> vcONVIFnode;
	vector<NODEITEM*> vcENCPnode;
	m_pbk->GetONVIFNodes(vcONVIFnode);
	vcENCPnode = CIPCamDiscovery::GetNodePtr();
	vector<CString> vcStrIP;
	vector<CString>::iterator it;
	CString str;
	int nIdx = 0, nCount = vcONVIFnode.size();
	for(nIdx = 0; nIdx < nCount; nIdx++)
	{
		str.Empty();
		str = A2W(vcONVIFnode[nIdx].ip);
		vcStrIP.push_back(str);
	}

	nCount = vcENCPnode.size();
	for(nIdx = 0; nIdx < nCount; nIdx++)
	{
		str.Empty();
		str = A2W(vcENCPnode[nIdx]->ip);
		it = find(vcStrIP.begin(),vcStrIP.end(),str);
		if (it != vcStrIP.end())
		{
			int nIdx = it-vcStrIP.begin();
			vcStrIP.erase(it);
			vcONVIFnode.erase(vcONVIFnode.begin()+nIdx);
		}
	}

	CString strAddress, strPort;
	GetKeyinAddress(strAddress, strPort);

	nCount = vcONVIFnode.size();
	for(nIdx = 0; nIdx < nCount; nIdx++)
	{
		str.Empty();
		str = A2W(vcONVIFnode[nIdx].ip);
		if (str == strAddress)
		{
			GetONVIF_RTSP(vcONVIFnode[nIdx].stream_url, m_strUserName, m_strPassword, vcONVIFnode[nIdx]);
			m_vcNodes.push_back(vcONVIFnode[nIdx]);
			bResult = true;
			break;
		}
	}
	return bResult;
}
Example #7
0
// ===========================================================
// searches the time-period by the specified zone, returns string "UNIT CHARGESTRING"
	void get_period_by_zone(const char *zone,CString &period)
// ===========================================================
{
CString str,tmp;
struct tm *loctime;
time_t tim;

	period.Empty();
	for (int t=0;t<costbaselist.GetCount();t++)
	{
		str=costbaselist.GetString(t);
		get_token(str,BASEZONE,tmp);
		if (!tmp.CompareNoCase(zone))
		{
			time(&tim);                /* Get time as long integer. */
			loctime = localtime(&tim); /* Convert to local time. */

			if (loctime->tm_wday == 0 || loctime->tm_wday == 6)
				get_token(str,BASEWEND,period);   // weekend
			else
				get_token(str,BASEWDAY,period);   // workdays

			get_token(str,BASECURR,tmp);	// currency
			strcpy(currency,tmp);
			get_token(str,BASEPERU,tmp);	// charging per unit
			period = tmp+" "+period;
			return;
		}
	}
}
Example #8
0
static
BOOL AnsiStrToWideStr(CString &wstr, const CHAR * str)
{
    BOOL result = FALSE;
    WCHAR *buffW = NULL;

    wstr.Empty();

    if( NULL != str )
    {
        int size = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
        if (size > 0)
        {
            buffW = new WCHAR[size];
            if (NULL != buffW)
            {
                if (0 < MultiByteToWideChar(CP_ACP, 0, str, -1, buffW, size))
                {
                    wstr = buffW;
                    result = TRUE;
                }
            }
        }
    }

    if (buffW) delete []buffW;
    return result;
}
Example #9
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 #10
0
void CParseString::GetHead(CString& word)
{
    word.Empty();
    int i;
    for (i = m_CurIndex; i >= 0 && IsSeparator(i); i--);
    if (i >= 0) word = Left(i + 1);
}
Example #11
0
BOOL CTDLFilterDlg::OnToolTipNotify(UINT /*id*/, NMHDR* pNMHDR, LRESULT* /*pResult*/)
{
    // Get the tooltip structure.
    TOOLTIPTEXT *pTTT = (TOOLTIPTEXT *)pNMHDR;

    // Actually the idFrom holds Control's handle.
    UINT CtrlHandle = pNMHDR->idFrom;

    // Check once again that the idFrom holds handle itself.
    if (pTTT->uFlags & TTF_IDISHWND)
    {
		static CString sTooltip;
		sTooltip.Empty();

        // Get the control's ID.
        UINT nID = ::GetDlgCtrlID( HWND( CtrlHandle ));

        switch( nID )
        {
        case IDC_CATEGORYFILTERCOMBO:
			sTooltip = m_cbCategoryFilter.GetTooltip();
            break;

        case IDC_ALLOCTOFILTERCOMBO:
			sTooltip = m_cbAllocToFilter.GetTooltip();
            break;

        case IDC_STATUSFILTERCOMBO:
			sTooltip = m_cbStatusFilter.GetTooltip();
            break;

        case IDC_ALLOCBYFILTERCOMBO:
			sTooltip = m_cbAllocByFilter.GetTooltip();
            break;

        case IDC_VERSIONFILTERCOMBO:
			sTooltip = m_cbVersionFilter.GetTooltip();
            break;

        case IDC_TAGFILTERCOMBO:
			sTooltip = m_cbTagFilter.GetTooltip();
            break;

        case IDC_OPTIONFILTERCOMBO:
			sTooltip = m_cbOptions.GetTooltip();
            break;
        }

		if (!sTooltip.IsEmpty())
		{
			// Set the tooltip text.
			::SendMessage(pNMHDR->hwndFrom, TTM_SETMAXTIPWIDTH, 0, 300);
			pTTT->lpszText = (LPTSTR)(LPCTSTR)sTooltip;
	        return TRUE;
		}
    }

    // Not handled.
    return FALSE;
}
Example #12
0
void CLoginWnd::Login(WPARAM wParam, LPARAM lParam)
{
	m_bcAncelogin = false;
	m_buserislogin = true;
	//用户登录
	if (!m_bcAncelogin) {
		CString userdata;
		userdata.Empty();
		////保存用户信息,方便写入配置文件
		m_szuser = m_pUser->GetText();
		m_szpasswrod = m_pPassWord->GetText();
		//userdata.Format(L"login %s %s\n", m_user, m_passwrod);
		////socket连接方便客户端保存socket
		//bool ret = ssl->Connect("10.10.4.66", 4002);

		//if (!ret) {
		//	MessageBox(NULL, L"网络异常,无法连接到服务器", L"用户登录", MB_OK);
		//} else {

		//	if (LoginSSL(userdata)) {
				LoginISRight(true);
			/*} else {
				MessageBox(NULL, L"服务器接受数据失败", L"用户登录", MB_OK);
			}

		}*/
	}
	
}
Example #13
0
//
//  機能     : 古いログの削除
//  
//  機能説明 : LOG_EXPIRE 日以上前のログは削除
//  
//  返り値   : true  正常終了
//             false エラー発生
//  
//  備考     : 
//  
bool CTPerror::DelOldLog()
{
	CString str;
	CFileFind finder;
	CTime ntm;
	CTime tm;
	CTimeSpan tms;
	CFileSpec fs;

	/// LOG_EXPIRE期間以前のログファイルを削除
	if (!SetCurrentDirectory(LogDir)) return false;
	ntm = CTime::GetCurrentTime();
	BOOL bWorking = finder.FindFile(_T("*.log"));
	if (!bWorking) return false;
	str.Empty();
	while (bWorking)
	{
		bWorking = finder.FindNextFile();
		if (!finder.IsDirectory()) {
			str = finder.GetFileName();
			/// ログファイル作成日付と現在との差分
			finder.GetCreationTime(tm);
			tms = ntm - tm;
			if (tms.GetDays() > LOG_EXPIRE) {
				fs.SetFullSpec(str);
				if (!fs.Exist()) continue;
				fs.FileDelete();
			}
		}
	}
	finder.Close();

	return true;
}
Example #14
0
// Takes access to a string, default peek false to move a line from the buffer to the string, and default CP_ACP to read ASCII text
// Looks for bytes like "line\r\n" in the buffer, and moves them from the buffer to the string, throwing away the "\r\n" part
// Returns true if a line was found and moved from the buffer to the string, false if there isn't a '\n' in the buffer right now
BOOL CBuffer::ReadLine(CString& strLine, BOOL bPeek, UINT nCodePage)
{
    // Empty the string, making it blank
    strLine.Empty();

    // If this buffer is empty, tell the caller we didn't find a complete line
    if ( ! m_nLength ) return FALSE;

    // Scan down each byte in the buffer
    DWORD nLength;
    for ( nLength = 0 ; nLength < m_nLength ; nLength++ )
    {
        // If the byte at this length is the newline character '\n', exit the loop
        if ( m_pBuffer[ nLength ] == '\n' ) break;
    }

    // If the loop didn't find a '\n' and instead stopped because nLength grew to equal m_nLength
    if ( nLength >= m_nLength ) return FALSE; // There isn't an '\n' in the buffer, tell the caller we didn't find a complete line

    // Convert the nLength ASCII characters in the buffer into wide characters in strLine
    int nWide = MultiByteToWideChar( nCodePage, 0, (LPCSTR)m_pBuffer, nLength, NULL, 0 );
    MultiByteToWideChar( nCodePage, 0, (LPCSTR)m_pBuffer, nLength, strLine.GetBuffer( nWide ), nWide );
    strLine.ReleaseBuffer( nWide );

    // Find the last carriage return '\r' character in the string
    int nCR = strLine.ReverseFind( '\r' );   // Find the distance to the last \r, "hello\r" would be 5
    if ( nCR >= 0 ) strLine.Truncate( nCR ); // Cut the string to that length, like "hello"

    // Now that the line has been copied into the string, remove it and the '\n' from the buffer
    if ( ! bPeek ) Remove( nLength + 1 ); // Unless we're peeking, then leave it in the buffer

    // Report that we found a line and moved it from the buffer to the string
    return TRUE;
}
Example #15
0
void DlgRecent::GetSvrGNByIdx(CString &szOut, int iBkrG, int iSvrG)
{
	xml_document doc;
	xml_parse_result result;

	szOut.Empty();
	result = doc.load_file(gv_Bkr[iBkrG].XmlPath);
	if (result.status == status_ok)
	{
		///////////读出服务器//////////////////
		xpath_node_set sVrs = doc.select_nodes(_NDPATHSVR);
		if (sVrs.empty()) return;
		int iCount = 0;
		char strName[64];
		for (xpath_node_set::const_iterator it = sVrs.begin(); it != sVrs.end(); ++it)
		{
			xpath_node nd = *it;
			iCount++;
			//读出服务器组名称
			if (iCount == (iSvrG + 1))
			{
				strcpy(strName, nd.node().child_value(_NDNAME));
				ansi2uni(CP_ACP, strName, szOut.GetBuffer(MAX_PATH));
				szOut.ReleaseBuffer();

				break;
			}
		}
	}
}
Example #16
0
void CVistaView::OnInitialUpdate()
{
    CScrollView::OnInitialUpdate ();

    CString string;
    CSize sizeTotal;
    CBitmap* pBitmap = GetDocument ()->GetBitmap ();

	//
	// If a bitmap is loaded, set the view size equal to the bitmap size.
	// Otherwise, set the view's width and height to 0.
	//
    if (pBitmap != NULL) {
        DIBSECTION ds;
        pBitmap->GetObject (sizeof (DIBSECTION), &ds);
        sizeTotal.cx = ds.dsBm.bmWidth;
        sizeTotal.cy = ds.dsBm.bmHeight;
        string.Format (_T ("\t%d x %d, %d bpp"), ds.dsBm.bmWidth,
            ds.dsBm.bmHeight, ds.dsBmih.biBitCount);
    }
    else {
        sizeTotal.cx = sizeTotal.cy = 0;
        string.Empty ();
    }

    AfxGetMainWnd ()->SendMessage (WM_USER_UPDATE_STATS, 0,
        (LPARAM) (LPCTSTR) string);
    SetScrollSizes (MM_TEXT, sizeTotal);
}
Example #17
0
void SetFanDlg::OnOK()
{
	CString err;
	err.Empty();
	for(int i = 0; i < m_PP->m_NumPlayers; i++){
		if(m_Zi == 0 && !(i == m_HuPlayer || i == m_DianPlayer))
			continue;
		CString s;
		this->m_RichDianFinalFan[i].GetWindowTextW(s);
		if(_GetNum(s, m_DianFinalFan[i]) != 0)
			err = err + L"玩家" + m_PP->m_PlayersInfo[i].m_Name + L"的番数无法识别\n";
	}
	if(err.IsEmpty()){
		int sum = 0;
		for(int i = 0; i < m_PP->m_NumPlayers; i++){
			sum += m_DianFinalFan[i];
		}
		if(sum != 0){
			AfxMessageBox(L"番数和不等于0");
			return;
		}
		CDialog::OnOK();
	}
	else{
		AfxMessageBox(err);
	}
}
Example #18
0
// 1 => show + send + wait ; 2 => show + send ; 0 => send
int context::bmodemsendcomm(const char *info, const char *s,int show)
{
  CString q;
  int o = 0,result;

  do {
    if (show) f->conprint(info,1,0);
    Sleep(v.modem_delay*100);
    bmodemsendstr(s);
    if (show==0||show==2) return 1;
    DWORD c = GetTickCount() + v.waitmdmanswer*1000;
    result = 0;
    while (c>=GetTickCount()){
      while(int i = bmodemgetchar()){
        if (i==13||i==10){
          if (q==v.ok) result = 1;
          q.Empty();
        } else q+=char(i);
      }
      if (result) break;
      Sleep(0);
    }
    o++;
    if (result) f->conresult(14,"OK",0); else f->conresult(14,"ERROR",0);
  } while(!result&&o<3);

  return result;
}
Example #19
0
inline CString& CTobCompiler::GetErrorString(CString& str)
{
    if (m_line > 0)    str.Format("ERROR(%d): %s", m_line, (LPCTSTR)m_err);
    else            str.Format("ERROR: %s", (LPCTSTR)m_err);
    m_err.Empty();
    return str;
}
Example #20
0
BOOL CADORecordset::GetChunk(FieldPtr pField, CString& strValue)
{
	CString str;
	long lngSize, lngOffSet = 0;
	_variant_t varChunk;

	lngSize = pField->ActualSize;
	
	str.Empty();
	while(lngOffSet < lngSize)
	{ 
		try
		{
			varChunk = pField->GetChunk(ChunkSize);
			
			str += varChunk.bstrVal;
			lngOffSet += ChunkSize;
		}
		catch(_com_error &e)
		{
			dump_com_error(e);
			return FALSE;
		}
	}

	lngOffSet = 0;
	strValue = str;
	return TRUE;
}
Example #21
0
void CMountPoints::GetDriveVolumes()
{
	m_drive.SetSize(32);

	DWORD drives= GetLogicalDrives();
	int i;
	DWORD mask= 0x00000001;
	for (i=0; i < 32; i++, mask <<= 1)
	{
		CString volume;

		if ((drives & mask) != 0)
		{
			CString s;
			s.Format(_T("%c:\\"), i + _T('A'));

			BOOL b= m_va.GetVolumeNameForVolumeMountPoint(s, volume.GetBuffer(_MAX_PATH), _MAX_PATH);
			volume.ReleaseBuffer();

			if (!b)
			{
				TRACE(_T("GetVolumeNameForVolumeMountPoint(%s) failed.\n"), s);
				volume.Empty();
			}
		}

		m_drive[i]= volume;
	}
}
Example #22
0
CString CTreePropSheet::SplitPageTreePath(CString &strRest)
{
	int	nSeperatorPos = 0;
	while (TRUE)
	{
		nSeperatorPos = strRest.Find(_T("::"), nSeperatorPos);
		if (nSeperatorPos == -1)
		{
			CString	strItem(strRest);
			strRest.Empty();
			return strItem;
		}
		else if (nSeperatorPos>0)
		{
			// if there is an odd number of backslashes infront of the
			// seperator, than do not interpret it as separator
			int	nBackslashCount = 0;
			for (int nPos = nSeperatorPos-1; nPos >= 0 && strRest[nPos]==_T('\\'); --nPos, ++nBackslashCount);
			if (nBackslashCount%2 == 0)
				break;
			else
				++nSeperatorPos;
		}
	}

	CString	strItem(strRest.Left(nSeperatorPos));
	strItem.Replace(_T("\\::"), _T("::"));
	strItem.Replace(_T("\\\\"), _T("\\"));
	strRest = strRest.Mid(nSeperatorPos+2);
	return strItem;
}
CBenubirdAutoProxy::CBenubirdAutoProxy()
{
	g_strDBG.Empty();
	g_strDBG.Format(_T("------------------------------------- start AutoProxy  %X"),this);
	OutputDebugString(g_strDBG);


	EnableAutomation();
	
	// To keep the application running as long as an automation 
	//	object is active, the constructor calls AfxOleLockApp.
	AfxOleLockApp();

	// Get access to the dialog through the application's
	//  main window pointer.  Set the proxy's internal pointer
	//  to point to the dialog, and set the dialog's back pointer to
	//  this proxy.
	ASSERT_VALID(AfxGetApp()->m_pMainWnd);
	if (AfxGetApp()->m_pMainWnd)
	{
		ASSERT_KINDOF(CMainFrame, AfxGetApp()->m_pMainWnd);
		if (AfxGetApp()->m_pMainWnd->IsKindOf(RUNTIME_CLASS(CMainFrame)))
		{
			m_pDialog = reinterpret_cast<CMainFrame*>(AfxGetApp()->m_pMainWnd);
			m_pDialog->m_pAutoProxy = this;
		}
	}
}
void CInteractionAreaDialog::SetActionText(CMouseAction *pMouseAction, int nEditId)
{	
	CString csText;
	csText.Empty();

	UINT nPageOrMarkId = pMouseAction->GetPageMarkId();
	AreaActionTypeId nActionTypeId = pMouseAction->GetActionId();

	if (nActionTypeId == INTERACTION_JUMP_SPECIFIC_PAGE)
	{
      csText = m_pEditorDoc->project.GetPageTitleForId(nPageOrMarkId);
   }
	else if (nActionTypeId == INTERACTION_JUMP_TARGET_MARK)
	{
		CArray<CStopJumpMark *, CStopJumpMark *> caJumpMarks;
		CMarkStream *pMarkStream = m_pEditorDoc->project.GetMarkStream();
		pMarkStream->GetJumpMarksInRegion(caJumpMarks, 0, m_pEditorDoc->m_displayEndMs);
		for (int i = 0; i < caJumpMarks.GetSize(); ++i)
		{
			if (caJumpMarks[i]->GetId() == nPageOrMarkId)
			{
				csText = caJumpMarks[i]->GetLabel();
				break;
			}
		}
      caJumpMarks.RemoveAll();
	}
	else if (nActionTypeId == INTERACTION_OPEN_URL || nActionTypeId == INTERACTION_OPEN_FILE)
	{
		csText = pMouseAction->GetPath();
	}

	CEdit *pEdit = (CEdit *)GetDlgItem(nEditId);
	pEdit->SetWindowText(csText);
}
Example #25
0
CString & CDriveViewer::GetDriveInfoStr(const TCHAR *path)
{
	CDriveArray drArray;
	::GetDrives(drArray);
			
	static CString info;
	info.Empty ();

	if (drArray.size() == 0)
		MarkForUpdate();

	for (int i = 0; i < static_cast<int>(drArray.size()); i++ )
	{
	  if (drArray[i].m_nType == DRIVE_FIXED)
		  if (PathIsSameRoot (path, drArray[i].m_Path))
		  {
			  //info += m_Array[i].as_text(0);
			  //info += m_Array[i].m_Path;
			  //info += "  ";
			  TCHAR buf[128];
			  StrFormatByteSize64 (drArray[i].m_FreeSpace, buf, 127);
			  //info += m_Array[i].as_text(0);
			  if (*path && path[0] > 0) {
			     info += path[0];
				 info += TEXT(": ");
			  }
			 
			  info += buf;
			  info += " free ";
		  }
	}
	return info;
}
Example #26
0
void CKadSearchListCtrl::Localize()
{
	CHeaderCtrl* pHeaderCtrl = GetHeaderCtrl();
	HDITEM hdi;
	hdi.mask = HDI_TEXT;
	CString strRes;

	for (int icol = 0; icol < pHeaderCtrl->GetItemCount(); icol++)
	{
		switch (icol)
		{
			case colNum: strRes = GetResString(IDS_NUMBER); break;
			case colKey: strRes = GetResString(IDS_KEY); break;
			case colType: strRes = GetResString(IDS_TYPE); break;
			case colName: strRes = GetResString(IDS_SW_NAME); break;
			case colStop: strRes = GetResString(IDS_STATUS); break;
			case colResponses: strRes = GetResString(IDS_RESPONSES); break;
			case colLoad: strRes = GetResString(IDS_THELOAD); break;
			case colPacketsSent: strRes = GetResString(IDS_PACKSENT); break;
			default: strRes.Empty(); break;
		}
		hdi.pszText = const_cast<LPTSTR>((LPCTSTR)strRes);
		pHeaderCtrl->SetItem(icol, &hdi);
	}

	int iItems = GetItemCount();
	for (int i = 0; i < iItems; i++)
		SearchRef((Kademlia::CSearch *)GetItemData(i));

	UpdateKadSearchCount();
}
Example #27
0
   void CCurRecordset::GetFieldValue(short nIndex, CString& strValue)
{
	ASSERT_VALID(this);
	ASSERT(IsOpen());

	// No data or no column info fetched yet
	if (GetODBCFieldCount() <= 0)
	{
		ASSERT(FALSE);
		return;
	}

	// Convert index to 1-based and check range
	nIndex++;
	if (nIndex < 1 || nIndex > GetODBCFieldCount())
	{
		ThrowDBException(AFX_SQL_ERROR_FIELD_NOT_FOUND);
	}

	int nLen = GetTextLen(m_rgODBCFieldInfos[nIndex - 1].m_nSQLType,
			m_rgODBCFieldInfos[nIndex - 1].m_nPrecision);
#ifndef _UNICODE
		CString& strData = strValue;
#else
		CString strProxy;
		CString& strData = strProxy;
#endif
	void* pvData = strData.GetBufferSetLength(nLen);

	// Now can actually get the data
	long nActualSize = GetData(m_pDatabase, m_hstmt, nIndex,
		SQL_C_CHAR, pvData, nLen,
		m_rgODBCFieldInfos[nIndex - 1].m_nSQLType);

	// Handle NULL data separately
	if (nActualSize == SQL_NULL_DATA)
	{
		// Clear value
		strValue.Empty();
	}
	else
	{
		// May need to cleanup and call SQLGetData again if necessary
		GetLongCharDataAndCleanup(m_pDatabase, m_hstmt, nIndex,
			nActualSize, &pvData, nLen, strData,
			m_rgODBCFieldInfos[nIndex - 1].m_nSQLType);

#ifdef _UNICODE
	// Now must convert string to UNICODE
	strValue = (LPCSTR)strData.GetBuffer(0);
#endif // _UNIOCDE
	}

	if(m_rgODBCFieldInfos[nIndex - 1].m_nSQLType == SQL_BINARY ||
		m_rgODBCFieldInfos[nIndex - 1].m_nSQLType == SQL_LONGVARBINARY ||
		m_rgODBCFieldInfos[nIndex - 1].m_nSQLType == SQL_VARBINARY)
		if(!strValue.IsEmpty())
			strValue = _T("0x") + strValue;
}
Example #28
0
int CTGitPathList::FillUnRev(unsigned int action, CTGitPathList *list, CString *err)
{
	this->Clear();
	CTGitPath path;

	int count;
	if(list==NULL)
		count=1;
	else
		count=list->GetCount();
	for (int i = 0; i < count; ++i)
	{
		CString cmd;
		int pos = 0;

		CString ignored;
		if(action & CTGitPath::LOGACTIONS_IGNORE)
			ignored= _T(" -i");

		if(list==NULL)
		{
			cmd=_T("git.exe ls-files --exclude-standard --full-name --others -z");
			cmd+=ignored;

		}
		else
		{	cmd.Format(_T("git.exe ls-files --exclude-standard --full-name --others -z%s -- \"%s\""),
					(LPCTSTR)ignored,
					(*list)[i].GetWinPath());
		}

		BYTE_VECTOR out, errb;
		out.clear();
		if (g_Git.Run(cmd, &out, &errb))
		{
			if (err != nullptr)
				CGit::StringAppend(err, &errb[0], CP_UTF8, (int)errb.size());
			return -1;
		}

		pos=0;
		CString one;
		while (pos >= 0 && pos < (int)out.size())
		{
			one.Empty();
			CGit::StringAppend(&one, &out[pos], CP_UTF8);
			if(!one.IsEmpty())
			{
				//SetFromGit will clear all status
				path.SetFromGit(one);
				path.m_Action=action;
				AddPath(path);
			}
			pos=out.findNextString(pos);
		}

	}
	return 0;
}
//////////////////////////////////////////////////////////////////////////////
// audio device handle functions 
CString GetHardwareId(LPCTSTR lpszPnpId)
{
	CString strPnpIds = (LPCTSTR)(lpszPnpId + 4); // skip _T("\\?\");
	int nFind = strPnpIds.Find(_T("#"));
	if (nFind != -1) {
		nFind = strPnpIds.Find(_T("#"), nFind + 1);
		if (nFind != -1)
			strPnpIds.Delete(nFind, strPnpIds.GetLength() - nFind);
		else
			strPnpIds.Empty();
	}
	else {
		strPnpIds.Empty();
	}

	return strPnpIds;
}
Example #30
0
void CParseString::GetTail(CString& word)
{
    word.Empty();

    int i;
    for (i = m_CurIndex; i < GetLength() && IsSeparator(i); i++);
    if (i < GetLength()) word = Mid(i);
}