当前位置: 首页>>代码示例>>C++>>正文


C++ CArray::GetCount方法代码示例

本文整理汇总了C++中CArray::GetCount方法的典型用法代码示例。如果您正苦于以下问题:C++ CArray::GetCount方法的具体用法?C++ CArray::GetCount怎么用?C++ CArray::GetCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CArray的用法示例。


在下文中一共展示了CArray::GetCount方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: OnInitDialog


//.........这里部分代码省略.........
			}

			if (m_pStrategy->m_pData && m_pStrategy->m_pData->m_pCurVal)
			{ 
				CString cs;
				char c[7] = {0};
				strncpy(c,m_pStrategy->m_cCode,6);
				m_wndCode.SetWindowText(c);//股票代码
				//--------------------------------------------
				switch(m_pStrategy->m_nPeriodType)
				{
				case AnalisysFor1:
					cs = "1分钟";
					break;
				case AnalisysFor5:
					cs = "5分钟";
					break;
				case AnalisysFor15:
					cs = "15分钟";
					break;
				case AnalisysFor30:
					cs = "30分钟";
					break;
				case AnalisysFor60:
					cs = "60分钟";
					break;
				case AnalisysForDay:
					cs = "日线";
					break;
				case AnalisysForWeek:
					cs = "周线";
					break;
				case AnalisysForMonth:
					cs = "月线";
					break;
				default:
					cs = "多日线";
					break;
				}
				if (cs == "多日线" || cs.IsEmpty())
				{
					m_wndDay.EnableWindow(TRUE);
				}
				m_wndCycle.SelectString(-1,cs);
				//--------------------------------------------------
				cs.Format("%d",m_pStrategy->m_nMaxBuyTimes);
				m_wndBuyTimes.SetWindowText(cs);
				cs.Format("%d",m_pStrategy->m_nMaxSellTimes);
				m_wndSellTimes.SetWindowText(cs);
				cs.Format("%d",m_pStrategy->m_nTrigTimes);
				m_wndTriggerTime.SetWindowText(cs);
				cs.Format("%d",m_pStrategy->m_nMaxTrigTimes);
				m_wndTrigerNum.SetWindowText(cs);
				cs.Format("%d",m_pStrategy->m_nPeriodNumber);
				m_wndDay.SetWindowText(cs);
				cs.Format("%d",m_pStrategy->m_nGap);
				m_wndGap.SetWindowText(cs);
				if (m_pStrategy->m_bFuQuan == 0)
				{
					m_wndCheck.SetCheck(TRUE);	
				}
				if (m_pStrategy->m_bXD == 1)
				{
					m_wndXD.SetCheck(TRUE);
				}
				CArray<CTreeGroup*,CTreeGroup*>* pTreeGp = pCurTree->GetTreeGroup();
				int sel = 0;
				for (; sel<pTreeGp->GetCount(); sel++)
				{
					CTreeGroup *pGp = pTreeGp->GetAt(sel);
					CString csName = pGp->GetName();
					CString cExpName = m_pStrategy->m_sExpName;
					if (pGp && csName == cExpName)
					{
						break;
					}
				}

				if (sel < pTreeGp->GetCount())
				{
					CTreeGroup *ptg = pTreeGp->GetAt(sel);					
					
					m_bSetVar = TRUE;
					pCurTree->Show(ptg->GetData(),0);
			
				}
				else
				{
					pCurTree->Show(NULL,0);
				}
			}
			else
				pCurTree->Show(NULL,0);
		}

	}

	return TRUE;  // return TRUE unless you set the focus to a control
	// EXCEPTION: OCX Property Pages should return FALSE
}
开发者ID:hefen1,项目名称:XCaimi,代码行数:101,代码来源:DlgStrategyHQ.cpp

示例2: ChangeTabGroup

BOOL CDrawQuoteTabCtrl::ChangeTabGroup( CString strGroup /*= _T("")*/, BOOL bForce /*= FALSE*/ )
{
	if (strGroup.IsEmpty())
	{
		strGroup = GetDefaultTabGroupName();
	}
	if (m_strCurGroupName == strGroup && !bForce)
	{
		return FALSE;
	}	
	m_strCurGroupName = strGroup;
	m_nCurItem = -1;

	PageInfo pageInfo;
	CTabItemArray ayTabItem;
	LONG nCount = m_iTab->GetTabList(strGroup, ayTabItem);
	if (nCount <= 0)
	{
		return FALSE;
	}

	RemoveTabItem(-1);
	int nItemID = m_iTab->GetDefaultTabItemID();
	int nDefault(0);

	CArray<StockType> ayBlockMarket;
	TabItem* pItem = NULL;
	for (int i = 0, j = 0; i < nCount; i++)
	{
		pItem = ayTabItem.GetAt(i);

		ayBlockMarket.RemoveAll();
		m_pDataSource->HSDataSourceEx_GetSystemMarketInfo((unsigned short*)pItem->m_sMarket, MARKETTYPE_COUNT, ayBlockMarket);
		if (ayBlockMarket.GetCount() != 0)
		{
			// 如果服务器当面配置了名称 以服务器那边的名称为主
			strncpy(pItem->m_szName, ayBlockMarket.GetAt(0).m_stTypeName.m_szName, min(strlen(pItem->m_szName), strlen(ayBlockMarket.GetAt(0).m_stTypeName.m_szName)));
			j++;
		}

		if (pItem->m_ID == nItemID)
			nDefault = j - 1;
		
		pageInfo.m_lPageType = pItem->m_lPageType;
		pageInfo.m_lInPageTag = pItem->m_lPageTag;
		for (int i = 0; i < MARKETTYPE_COUNT; i++)
		{
			pageInfo.m_sMarket[i] = pItem->m_sMarket[i];
		}
		memcpy(pageInfo.m_szBlock,pItem->m_szBlock,BLOCK_NAME_LENGTH);
		AddTabItem(pItem->m_szName, pItem->m_ID, pItem->m_lMenuMask, &pageInfo, pItem->m_szColGroupName);
	}
	if (strGroup == GetDefaultTabGroupName())
	{
		ChangeCurItem(nDefault);
	}
	else
		ChangeCurItem(0);
//	m_nLeftOffset = 0;
//	Invalidate(FALSE);
	return TRUE;
}
开发者ID:hefen1,项目名称:XCaimi,代码行数:62,代码来源:DrawQuoteTabCtrl.cpp

示例3: OnDutyOff

void CMainFrame::OnDutyOff()
{
#ifndef _DEBUG
	if (!CRightsManagement::GetInstance()->Take_IBAP_ONOFFDUTY(FALSE))
	{
		return;
	}
#endif
	
	//{ 2011/08/11-8201-gxx: 
	
	BOOL bNormal = TRUE;
	if (CIBAGlobal::NetworkStatus == CIBAGlobal::emNetworkRestore)
	{
		bNormal = FALSE;
	}
	else
	{
		CArray<CLocalConsumeInfo,CLocalConsumeInfo&> InfoArray; 
		CIBADAL::GetInstance()->GetLocalConsumes(InfoArray);
		if (InfoArray.GetCount() > 0)
		{
			bNormal = FALSE;
		}
	}

	if (theApp.GetCurCashier()->IsOnDuty() == FALSE)
	{
		bNormal = TRUE; // 能弹出上班界面
	}
	
	//}

	if (bNormal)
	{
		CDlgIBADuty dlg;

		if (theApp.GetCurCashier()->IsOnDuty())//是否在上班
		{
			if (dlg.DoModal() == IDOK)
			{
				//{ 2011/04/19-gxx: 判断在交班的时候,IBA是否有更新
				theApp.UpdateIBA();
				//}

				CJXCMainDlg::DestroyJxcMainDlg();//销毁非模态的进销存对话框

				UpdateStatusText();//更新状态栏

				CIBALoginDlg dlg2;//登入对话框
				dlg2.SetLoginType(1);//调整位置,不对原顶层窗体做要求

				if (dlg2.DoModal() == IDOK)
				{
					UpdateStatusText();//更新状态栏
				}
				else
				{
					CBCGPFrameWnd::OnClose();//退出
				}
			}
		}
		else
		{
			dlg.DoModal();
			UpdateStatusText();
		}
	}
	else
	{
		CDlgDutyLocal dlg;
		dlg.DoModal();
	}
}
开发者ID:layerfsd,项目名称:PersonalIBA,代码行数:74,代码来源:MainFrm.cpp

示例4: DrawItem

void CToolBarCtrlZ::DrawItem(CDC *pDC, int iIndex, const CRect &rtItem, BOOL bHover)
{
	UINT			uItemId;
	UINT			uItemState;
	TBBUTTON		tbb;


	TCHAR			szText[1024];
	TBBUTTONINFO	tbi;
	CArray<CxImage*, CxImage*>	*parrImgs = NULL;
	CxImage			*pIconImg = NULL;		
	int				iIconTop;
	CRect			rtDraw;
	CRect			rtText;
	COLORREF		clrText;
	
	CClientRect		rtClient(this);
	rtDraw = rtItem;
	rtDraw.top = rtClient.top;
	rtDraw.bottom = rtClient.bottom;

	if (!GetButton(iIndex, &tbb))
		return;

	uItemId = tbb.idCommand;
	uItemState = GetState(uItemId);

	parrImgs = &m_arrImgs;
	if ( !IsButtonEnabled(uItemId) )
	{
		clrText = RGB(204, 128, 128);
		if (0 != m_arrDisableImgs.GetCount())
			parrImgs = &m_arrDisableImgs;
	}
	else
	{
		clrText = RGB(255, 254, 253);

		if (TBSTATE_PRESSED & uItemState/*IsButtonPressed(uItemId)*/)
			rtDraw.OffsetRect(1, 1);
		else if (bHover/*iIndex == GetHotItem()*/)
			rtDraw.OffsetRect(-1, -2);
	}


	ZeroMemory(&tbi, sizeof(TBBUTTONINFO));
	tbi.cbSize = sizeof(TBBUTTONINFO);
	tbi.dwMask = TBIF_TEXT | TBIF_IMAGE;
	tbi.pszText = szText;
	tbi.cchText = 1024;
	//if (GetButtonInfo(p->nmcd.dwItemSpec, &tbi))
	GetButtonInfo(uItemId, &tbi);
	{

		rtText = rtDraw;

		if (tbi.iImage < parrImgs->GetCount())
		{
			pIconImg = parrImgs->GetAt(tbi.iImage);
			if (NULL != pIconImg)
			{
				iIconTop = rtDraw.Height() - pIconImg->GetHeight();
				iIconTop /= 2;
				iIconTop += rtDraw.top;
				pIconImg->Draw(pDC->GetSafeHdc(), rtDraw.left, iIconTop);
				rtText.left += pIconImg->GetWidth() + 4;
			}
		}


		{
			CWndFontDC	fontDC(pDC->GetSafeHdc(), GetSafeHwnd());
			CTextDC		textDC(pDC->GetSafeHdc(), clrText);
			
			pDC->DrawText(tbi.pszText, -1, &rtText, DT_LEFT | DT_VCENTER | DT_SINGLELINE);
		}
	}

}
开发者ID:techpub,项目名称:archive-code,代码行数:79,代码来源:ToolBarCtrlZ.cpp

示例5: Plane


//.........这里部分代码省略.........
        28591,  // 0a - ??? - ISO/IEC 8859-10
        28591,  // 0b - ??? - ISO/IEC 8859-11
        28591,  // 0c - ??? - ISO/IEC 8859-12
        28603,  // 0d - ISO 8859-13 Estonian
        28591,  // 0e - ??? - ISO/IEC 8859-14
        28605,  // 0f - ISO 8859-15 Latin 9

        // 0x10 to 0xFF - reserved for future use
    };

    CStringW strResult;
    if (uLength > 0) {
        UINT cp = CP_ACP;
        int nDestSize;

        if (pBuffer[0] == 0x10) {
            pBuffer++;
            uLength--;
            if (pBuffer[0] == 0x00) {
                cp = codepages10[pBuffer[1]];
            } else { // if (pBuffer[0] > 0x00)
                // reserved for future use, use default codepage
                cp = codepages[0];
            }
            pBuffer += 2;
            uLength -= 2;
        } else if (pBuffer[0] < 0x20) {
            cp = codepages[pBuffer[0]];
            pBuffer++;
            uLength--;
        } else { // No code page indication, use the default
            cp = codepages[0];
        }

        // Work around a bug in MS MultiByteToWideChar with ISO/IEC 6937 and take care of the Euro symbol special case (step 1/2)...
        CArray<size_t> euroSymbolPos;
        if (cp == 20269) {
            BYTE tmp;
            for (size_t i = 0; i < uLength - 1; i++) {
                if (pBuffer[i] >= 0xC1 && pBuffer[i] <= 0xCF && pBuffer[i] != 0xC9 && pBuffer[i] != 0xCC) {
                    // Swap the current char with the next one
                    tmp = pBuffer[i];
                    pBuffer[i] = pBuffer[i + 1];
                    pBuffer[++i] = tmp;
                } else if (pBuffer[i] == 0xA4) { // € was added as 0xA4 in the DVB spec
                    euroSymbolPos.Add(i);
                }
            }
            // Handle last symbol if it's a €
            if (pBuffer[uLength - 1] == 0xA4) {
                euroSymbolPos.Add(uLength - 1);
            }
        }

        nDestSize = MultiByteToWideChar(cp, MB_PRECOMPOSED, (LPCSTR)pBuffer, (int)uLength, nullptr, 0);
        if (nDestSize > 0) {
            LPWSTR strResultBuff = strResult.GetBuffer(nDestSize);
            MultiByteToWideChar(cp, MB_PRECOMPOSED, (LPCSTR)pBuffer, (int)uLength, strResultBuff, nDestSize);

            // Work around a bug in MS MultiByteToWideChar with ISO/IEC 6937 and take care of the Euro symbol special case (step 2/2)...
            if (cp == 20269) {
                for (size_t i = 0, len = (size_t)nDestSize; i < len; i++) {
                    switch (strResultBuff[i]) {
                        case 0x60: // grave accent
                            strResultBuff[i] = 0x0300;
                            break;
                        case 0xb4: // acute accent
                            strResultBuff[i] = 0x0301;
                            break;
                        case 0x5e: // circumflex accent
                            strResultBuff[i] = 0x0302;
                            break;
                        case 0x7e: // tilde
                            strResultBuff[i] = 0x0303;
                            break;
                        case 0xaf: // macron
                            strResultBuff[i] = 0x0304;
                            break;
                        case 0xf8f8: // dot
                            strResultBuff[i] = 0x0307;
                            break;
                    }
                }

                for (INT_PTR i = 0, len = euroSymbolPos.GetCount(); i < len; i++) {
                    strResultBuff[euroSymbolPos[i]] = _T('€');
                }
            }

            // Some strings seems to be null-terminated, we need to take that into account.
            while (nDestSize > 0 && strResultBuff[nDestSize - 1] == L'\0') {
                nDestSize--;
            }

            strResult.ReleaseBuffer(nDestSize);
        }
    }

    return strResult;
}
开发者ID:1ldk,项目名称:mpc-hc,代码行数:101,代码来源:Mpeg2SectionData.cpp

示例6: DrawConnections

void CRevisionGraphWnd::DrawConnections (GraphicsDevice& graphics, const CRect& /*logRect*/, const CSize& offset)
{

	CArray<PointF> points;
	CArray<CPoint> pts;

	if(graphics.graphics)
		graphics.graphics->SetSmoothingMode(Gdiplus::SmoothingModeAntiAlias);

	float penwidth = 2*m_fZoomFactor<1? 1:2*m_fZoomFactor;
	Gdiplus::Pen pen(Color(0,0,0),penwidth);

	// iterate over all visible lines
	edge e;
	forall_edges(e, m_Graph)
	{
		// get connection and point position
		const DPolyline &dpl = this->m_GraphAttr.bends(e);

		points.RemoveAll();
		pts.RemoveAll();

		PointF pt;
		pt.X = (REAL)m_GraphAttr.x(e->source());
		pt.Y = (REAL)m_GraphAttr.y(e->source());

		points.Add(pt);

		ListConstIterator<DPoint> it;
		for(it = dpl.begin(); it.valid(); ++it)
		{
			pt.X =  (REAL)(*it).m_x;
			pt.Y =  (REAL)(*it).m_y;
			points.Add(pt);
		}

		pt.X = (REAL)m_GraphAttr.x(e->target());
		pt.Y = (REAL)m_GraphAttr.y(e->target());

		points.Add(pt);

		points[0] = this->cutPoint(e->source(), 1, points[0], points[1]);
		points[points.GetCount()-1] =  this->cutPoint(e->target(), 1, points[points.GetCount()-1], points[points.GetCount()-2]);
		// draw the connection

		for (int i = 0; i < points.GetCount(); ++i)
		{
			//CPoint pt;
			points[i].X = points[i].X * this->m_fZoomFactor - offset.cx;
			points[i].Y = points[i].Y * this->m_fZoomFactor - offset.cy;
			//pts.Add(pt);
		}

		if (graphics.graphics)
		{
			graphics.graphics->DrawLines(&pen, points.GetData(), (INT)points.GetCount());

		}
		else if (graphics.pSVG)
		{
			Color color;
			color.SetFromCOLORREF(GetSysColor(COLOR_WINDOWTEXT));
			graphics.pSVG->Polyline(points.GetData(), (int)points.GetCount(), Color(0,0,0), (int)penwidth);
		}
		else if (graphics.pGraphviz)
		{
			CString hash1 = _T("g") + m_logEntries[e->target()->index()].ToString().Left(g_Git.GetShortHASHLength());
			CString hash2 = _T("g") + m_logEntries[e->source()->index()].ToString().Left(g_Git.GetShortHASHLength());
			graphics.pGraphviz->DrawEdge(hash1, hash2);
		}

		//draw arrow
		double dx = points[1].X - points[0].X;
		double dy = points[1].Y - points[0].Y;

		double len = sqrt(dx*dx + dy*dy);
		dx = m_ArrowSize * m_fZoomFactor *dx /len;
		dy = m_ArrowSize * m_fZoomFactor *dy /len;

		double p1_x, p1_y, p2_x, p2_y;
		p1_x = dx * m_ArrowCos - dy * m_ArrowSin;
		p1_y = dx * m_ArrowSin + dy * m_ArrowCos;

		p2_x = dx * m_ArrowCos + dy * m_ArrowSin;
		p2_y = -dx * m_ArrowSin + dy * m_ArrowCos;

		//graphics.graphics->DrawLine(&pen, points[0].X,points[0].Y, points[0].X +p1_x,points[0].Y+p1_y);
		//graphics.graphics->DrawLine(&pen, points[0].X,points[0].Y, points[0].X +p2_x,points[0].Y+p2_y);
		GraphicsPath path;

		PointF arrows[5];
		arrows[0].X =  points[0].X;
		arrows[0].Y =  points[0].Y;

		arrows[1].X =  points[0].X + (REAL)p1_x;
		arrows[1].Y =  points[0].Y + (REAL)p1_y;

		arrows[2].X =  points[0].X + (REAL)dx*3/5;
		arrows[2].Y =  points[0].Y + (REAL)dy*3/5;

//.........这里部分代码省略.........
开发者ID:fabgithub,项目名称:TortoiseGit,代码行数:101,代码来源:RevisionGraphDlgDraw.cpp

示例7: ScanDevice

bool CGPIBDevice::ScanDevice(CArray<IO_ADDRESS> &addresses)
{
	IO_ADDRESS addrnode;
	addresses.RemoveAll();
	int res;

	if (m_hGPIBDLL == NULL && !LoadGPIBDriver())
	{
		return false;
	}

	short primary_addrs[MAX_GPIB_PRIM_ADDR];
	short addr[MAX_ADDRESSES];

	for (int nAddr = 0; nAddr < MAX_ADDRESSES; nAddr++)
	{
		addr[nAddr] = (short)0xFFFF;
	}

	for (int nAddr = 0; nAddr < (MAX_GPIB_PRIM_ADDR - 2); nAddr++)
	{
		primary_addrs[nAddr] = (short)(nAddr + 1);
	}

	primary_addrs[MAX_GPIB_PRIM_ADDR - 2] = (short)0xFFFF;

	Log(_T("GPIB device scanning start!"));

	for (int nBus = 0; nBus < MAX_GPIB_CARD; nBus++)
	{
		ibonl(nBus, 1); if (ibsta & ERR) continue;
		ibconfig(nBus, IbcSC, 1); if (ibsta & ERR) continue;
		ibsic(nBus); if (ibsta & ERR) continue;
		ibconfig(nBus, IbcSRE, 1); if (ibsta & ERR) continue;
		ibconfig(nBus, IbcTIMING, 1); if (ibsta & ERR) continue;
		ibask(nBus, IbaPAD, &res); if (ibsta & ERR) continue;
		ibask(nBus, IbaSAD, &res); if (ibsta & ERR) continue;

		FindLstn(nBus, primary_addrs, addr, MAX_ADDRESSES - 1);

		if (ibsta & ERR) continue;

		for (int i = 0; i < (MAX_ADDRESSES - 1); i++)
		{
			if (addr[i] == -1) break;

			memset(&addrnode, 0, sizeof(IO_ADDRESS));

			addrnode.nBus = nBus;
			addrnode.eType = DRV_GPIB;
			addrnode.nPrimAddr = (addr[i] & 0xFF);
			addrnode.nSecAddr = ((addr[i] & 0xFF00) >> 8);

			addrnode.bPrimary = (i == 0 || addresses[i - 1].nPrimAddr != addrnode.nPrimAddr);

			if (addrnode.bPrimary && !Open(nBus, addrnode.nPrimAddr, addrnode.nSecAddr)) continue;

			if (!addrnode.bPrimary)
				strcpy_s(addrnode.sDevIdentity, addresses[i - 1].sDevIdentity);
			else
			{
				int nReadLen = MAX_DEV_IDN_LEN;
				CString strIDN;

				if (!Query("*IDN?", nReadLen, addrnode.sDevIdentity, 1000))
				{
					Log(CCommon::FormatString(_T("Failed to query identity of  device at GPIB::%d::%d::%d"), nBus, addrnode.nPrimAddr, addrnode.nSecAddr));

					Close();
					continue;
				}

				Close();
			}

			addresses.Add(addrnode);
		}
	}

	if (addresses.GetCount() == 0)
	{
		Log(_T("Found no GPIB device!"));
		return false;
	}

	return true;
}
开发者ID:lidongqiang,项目名称:wvpctool,代码行数:87,代码来源:GPIBDevice.cpp

示例8: OnPaint

void CKadLookupGraph::OnPaint()
{
	m_aNodesDrawRects.RemoveAll();
	CPaintDC pdc(this);

	CRect rcClnt;
	GetClientRect(&rcClnt);
	if (rcClnt.IsRectEmpty())
		return;

	CMemDC dc(&pdc, rcClnt);
	CPen* pOldPen = dc.SelectObject(&m_penAxis);
	if (g_xpStyle.IsThemeActive() && g_xpStyle.IsAppThemed())
	{
		HTHEME hTheme = g_xpStyle.OpenThemeData(NULL, L"ListView");
		if (hTheme)
		{
			g_xpStyle.DrawThemeBackground(hTheme, dc.m_hDC, 3, 0, &rcClnt, NULL);
			g_xpStyle.CloseThemeData(hTheme);
		}
	}
	else
	{
		dc.Rectangle(&rcClnt);
	}
	rcClnt.DeflateRect(1, 1, 1, 1);
	dc.FillSolidRect(rcClnt, GetSysColor(COLOR_WINDOW));
	rcClnt.DeflateRect(1, 1, 1, 1);
	COLORREF crOldTextColor = dc.SetTextColor(GetSysColor(COLOR_WINDOWTEXT));

	CFont* pOldFont = dc.SelectObject(AfxGetMainWnd()->GetFont());
	if (!m_bInitializedFontMetrics)
	{
		TEXTMETRIC tm;
		dc.GetTextMetrics(&tm);
		// why is 'tm.tmMaxCharWidth' and 'tm.tmAveCharWidth' that wrong?
		CRect rcLabel;
		dc.DrawText(_T("888"), 3, &rcLabel, DT_CALCRECT);
		m_iMaxNumLabelWidth = rcLabel.Width();
		if (m_iMaxNumLabelWidth <= 0)
			m_iMaxNumLabelWidth = 3*8;
		m_iMaxLabelHeight = tm.tmHeight;
		if (m_iMaxLabelHeight <= 0)
			m_iMaxLabelHeight = 8;
		m_bInitializedFontMetrics = true;
	}

	int iLeftBorder = 3;
	int iRightBorder = 8;
	int iTopBorder = m_iMaxLabelHeight;
	int iBottomBorder = m_iMaxLabelHeight;

	int iBaseLineX = iLeftBorder;
	int iBaseLineY = rcClnt.bottom - iBottomBorder;
	UINT uHistWidth = rcClnt.Width() - iLeftBorder - iRightBorder;
	UINT uHistHeight = rcClnt.Height() - iTopBorder - iBottomBorder;
	if (uHistHeight == 0) {
		dc.SelectObject(pOldFont);
		dc.SetTextColor(crOldTextColor);
		return;
	}


	dc.MoveTo(iBaseLineX, rcClnt.top + iTopBorder);
	dc.LineTo(iBaseLineX, iBaseLineY);
	dc.LineTo(iBaseLineX + uHistWidth, iBaseLineY);

	dc.SelectObject(&m_penAux);

	CRect rcLabel(rcClnt);
	rcLabel.left = iBaseLineX;
	rcLabel.bottom = m_iMaxLabelHeight;
	dc.DrawText(m_strYaxis, m_strYaxis.GetLength(), &rcLabel, DT_LEFT | DT_TOP | DT_NOCLIP);

	rcLabel = rcClnt;
	rcLabel.top = rcClnt.bottom - m_iMaxLabelHeight + 1;
	dc.DrawText(m_strXaxis, m_strXaxis.GetLength(), &rcLabel, DT_RIGHT | DT_BOTTOM | DT_NOCLIP);

	if (m_pLookupHistory != NULL && m_pLookupHistory->GetHistoryEntries().GetCount() >= 1)
	{
		// How many nodes can we show without scrolling?
		sint32 uMaxNodes = uHistWidth / NODE_ENTRY_WIDTH;
		uint32 uNodeEntryWidth = 0;
		if (m_pLookupHistory->GetHistoryEntries().GetCount() > uMaxNodes /*|| !m_pLookupHistory->IsSearchStopped()*/)
			uNodeEntryWidth = NODE_ENTRY_WIDTH; // While the search is running, use a fixed width
		else
			uNodeEntryWidth = uHistWidth / m_pLookupHistory->GetHistoryEntries().GetCount(); // when the search is finished, use all available screen space

		sint32 iVisibleNodes = min(uMaxNodes, m_pLookupHistory->GetHistoryEntries().GetCount());

		// Set the scaling. 3 times the highest distance of the 1/3 closest nodes is the max distance
		CArray<CUInt128> aClosest;
		for (int i = 1; i <= iVisibleNodes; i++)
		{
			if (aClosest.GetCount() < ((iVisibleNodes / 3 == 0) ? 1 : (iVisibleNodes / 3)))
				aClosest.Add(m_pLookupHistory->GetHistoryEntries()[m_pLookupHistory->GetHistoryEntries().GetCount() - i]->m_uDistance);
			else
			{
				int iReplace = -1;
				for (int j = 0; j < aClosest.GetCount(); j++)
//.........这里部分代码省略.........
开发者ID:HackLinux,项目名称:eMule-Mirror,代码行数:101,代码来源:KadLookupGraph.cpp

示例9: OnInitDialog

BOOL CSubtitleDlDlg::OnInitDialog()
{
    __super::OnInitDialog();

    m_status.Create(WS_CHILD | WS_VISIBLE | CCS_BOTTOM, CRect(0, 0, 0, 0), this, IDC_STATUSBAR);

    int n, curPos = 0;
    CArray<int> columnWidth;

    CString strColumnWidth = AfxGetApp()->GetProfileString(IDS_R_DLG_SUBTITLEDL, IDS_RS_DLG_SUBTITLEDL_COLWIDTH, _T(""));
    CString token = strColumnWidth.Tokenize(_T(","), curPos);
    while (!token.IsEmpty()) {
        if (_stscanf_s(token, L"%d", &n) == 1) {
            columnWidth.Add(n);
            token = strColumnWidth.Tokenize(_T(","), curPos);
        } else {
            throw 1;
        }
    }

    m_list.SetExtendedStyle(m_list.GetExtendedStyle()
                            | LVS_EX_DOUBLEBUFFER | LVS_EX_FULLROWSELECT
                            | LVS_EX_CHECKBOXES   | LVS_EX_LABELTIP);

    if (columnWidth.GetCount() != 5) {
        // default sizes
        columnWidth.RemoveAll();
        columnWidth.Add(290);
        columnWidth.Add(70);
        columnWidth.Add(50);
        columnWidth.Add(50);
        columnWidth.Add(270);
    }

    m_list.InsertColumn(COL_FILENAME, ResStr(IDS_SUBDL_DLG_FILENAME_COL), LVCFMT_LEFT, columnWidth[0]);
    m_list.InsertColumn(COL_LANGUAGE, ResStr(IDS_SUBDL_DLG_LANGUAGE_COL), LVCFMT_CENTER, columnWidth[1]);
    m_list.InsertColumn(COL_FORMAT, ResStr(IDS_SUBDL_DLG_FORMAT_COL), LVCFMT_CENTER, columnWidth[2]);
    m_list.InsertColumn(COL_DISC, ResStr(IDS_SUBDL_DLG_DISC_COL), LVCFMT_CENTER, columnWidth[3]);
    m_list.InsertColumn(COL_TITLES, ResStr(IDS_SUBDL_DLG_TITLES_COL), LVCFMT_LEFT, columnWidth[4]);

    AddAnchor(IDC_LIST1, TOP_LEFT, BOTTOM_RIGHT);
    AddAnchor(IDC_CHECK1, BOTTOM_LEFT);
    AddAnchor(IDOK, BOTTOM_RIGHT);
    AddAnchor(IDC_STATUSBAR, BOTTOM_LEFT, BOTTOM_RIGHT);

    const CSize s(420, 200);
    SetMinTrackSize(s);
    EnableSaveRestore(IDS_R_DLG_SUBTITLEDL);

    // set language sorting order
    const CAppSettings& settings = AfxGetAppSettings();
    CString order = settings.strSubtitlesLanguageOrder;
    // fill language->position map
    int listPos = 0;
    int tPos = 0;
    CString langCode = order.Tokenize(_T(",; "), tPos);
    while (tPos != -1) {
        CString langName = LangCodeToName(CStringA(langCode));
        if (!langName.IsEmpty()) {
            int pos;
            if (!m_defps.m_langPos.Lookup(langName, pos)) {
                m_defps.m_langPos[langName] = listPos++;
            }
        }
        langCode = order.Tokenize(_T(",; "), tPos);
    }

    // start new worker thread to download the list of subtitles
    m_pTA = DEBUG_NEW THREADSTRUCT;
    m_pTA->url = m_url;
    m_pTA->hWND = GetSafeHwnd();

    SetStatus(ResStr(IDS_SUBDL_DLG_DOWNLOADING));
    AfxBeginThread(RunThread, static_cast<LPVOID>(m_pTA));

    return TRUE;
}
开发者ID:atlaste,项目名称:mpc-hc,代码行数:77,代码来源:SubtitleDlDlg.cpp

示例10: ApplyDocToTaskMgr


//.........这里部分代码省略.........
				}
				break;
			case FILESTATE_DOWNLOADED_SHARE:
			case FILESTATE_SHARE_TASK_DELED:
			case FILESTATE_DELETED: 
			case FILESTATE_ZEROSIZE_DOWNLOADED:
				{
					strFileName = CGlobalVariable::filemgr.GetUrlFileName(strUrl);
					SSpDownLink*	psdl = new SSpDownLink;
					psdl->iLinkType = 1;
					psdl->strLink = strUrl;
					psdl->iCat = 0;
					psdl->iState = iState;
					psdl->strName = strFileName;
					arrReDownLinks.Add(psdl);
				}
				break;
			default:
				CmdFuncs::ActualllyAddUrlDownload(strUrl,lpszLocation);
				break;
			}
		}
	}
	//	URL tasks	<end>

	int i;

	CString strPrompt;

	if (!arrSpDownLinks.IsEmpty()) 
	{
		strPrompt = GetResString(IDS_ALREADY_DOWNLOAD);

		for (i = 0; i < arrSpDownLinks.GetCount(); i++)
		{
			if(arrSpDownLinks[i]->iLinkType==1)
				strPrompt += arrSpDownLinks[i]->strLink;
			else
				strPrompt += arrSpDownLinks[i]->strName;
			strPrompt += _T("\n");
		}
		
		for (i = 0; i < arrSpDownLinks.GetCount(); i++)
			delete arrSpDownLinks[i];
		arrSpDownLinks.RemoveAll();
	}
	
	UINT iTooBigDownLinks = 0;
	if (!arrTooBigDownLinks.IsEmpty()) 
	{
		iTooBigDownLinks =arrTooBigDownLinks.GetCount();
		if (!strPrompt.IsEmpty())
			strPrompt += _T("\n\n");
		strPrompt = GetResString(IDS_ERR_FSCANTHANDLEFILE);
		strPrompt += _T("\n");

		for (i = 0; i < arrTooBigDownLinks.GetCount(); i++)
		{
			if(arrTooBigDownLinks[i]->iLinkType==1)
				strPrompt += arrTooBigDownLinks[i]->strLink;
			else
				strPrompt += arrTooBigDownLinks[i]->strName;
			strPrompt += _T("\n");
		}

		for (i = 0; i < arrTooBigDownLinks.GetCount(); i++)
开发者ID:techpub,项目名称:archive-code,代码行数:67,代码来源:DlgAddTask.cpp

示例11: QueryRegister

// 用户开户查询
void CCardopenConsumeView::QueryRegister(void)
{
	CArray<NS_DAL::CCardOpenInfo, NS_DAL::CCardOpenInfo &>  CardOpenDBArray;

	CString strSQL;

	strSQL.Append(_T("SELECT cardopen.*, member.classId, member.memberId, member.name, member.serialNum, member.idNumber  "));

	strSQL.Append(_T("FROM cardopen, member "));

	strSQL.Append(_T("WHERE  cardopen.memberId = member.memberId "));

	strSQL.Append(_T("AND  cardopen.classId = member.classId "));

	strSQL.AppendFormat(_T("AND  member.classId in %s "), GetCommonClassIdAsString());

	strSQL.AppendFormat(_T("AND cardopen.operationDateTime  BETWEEN '%s' AND '%s'")
		, m_StartTime.ToString(), m_EndTime.ToString());

	strSQL.Append(_T(" ORDER BY  cardopen.operationDateTime DESC"));

	CIBALog::GetInstance()->WriteFormat(CIBALog::ELT_SQL, _T("QueryRegister:%s"), strSQL);

	CADODBConnInfo* pDb = NULL;

	if (!CIBADAL::GetInstance()->GetDBConnInfo(pDb)) return;

	CADORecordset Rs(pDb->GetConn());

	if (Rs.Open(strSQL))
	{
		INT i = 0;

		while (!Rs.IsEof())
		{
			INT nTmp = 0;
			CString strTmp;
			CCardOpenInfo CardOpenInfo;

			Rs.GetFieldValue(_T("serialNum"), strTmp);
			CardOpenInfo.SetSerialNum(strTmp);

			Rs.GetFieldValue(_T("name"), strTmp);
			CardOpenInfo.SetUserName(strTmp);

			Rs.GetFieldValue(_T("idNumber"), strTmp);
			CardOpenInfo.SetIdNumber(strTmp);

			Rs.GetFieldValue(_T("memberId"), nTmp);
			CardOpenInfo.SetMemberId(nTmp);

			Rs.GetFieldValue(_T("operationDateTime"), strTmp);
			CardOpenInfo.SetOperationDateTime(strTmp);

			Rs.GetFieldValue(_T("operator"), strTmp);
			CardOpenInfo.SetOperator(strTmp);

			i++;
			CardOpenDBArray.Add(CardOpenInfo);
			Rs.MoveNext();
		}

		Rs.Close();
	}

	pDb->Release();

	for (INT ii = 0; ii < CardOpenDBArray.GetCount(); ii++)
	{
#ifdef _DEBUG
		if (CardOpenDBArray.GetAt(ii).GetMemberId() == 178547)
		{
			int kkk = 0;
		}
#endif

		CString strSQL;

		strSQL.Append(_T("SELECT returned.* "));

		strSQL.Append(_T("FROM returned "));

		strSQL.AppendFormat(_T("WHERE  returned.memberId = '%d' AND  returned.classId in %s  ")
			, CardOpenDBArray.GetAt(ii).GetMemberId(), GetCommonClassIdAsString());

		strSQL.AppendFormat(_T("AND returned.returnDate >=  '%s'")
			, CardOpenDBArray.GetAt(ii).GetOperationDateTime());

		strSQL.Append(_T(" ORDER BY returned.returnDate DESC"));

		CIBALog::GetInstance()->WriteFormat(CIBALog::ELT_SQL, _T("QueryReturned:%s"), strSQL);

		CADODBConnInfo* pDb = NULL;

		if (!CIBADAL::GetInstance()->GetDBConnInfo(pDb)) return;

		CADORecordset Rs(pDb->GetConn());

		if (Rs.Open(strSQL))
//.........这里部分代码省略.........
开发者ID:layerfsd,项目名称:PersonalIBA,代码行数:101,代码来源:CardopenConsumeDlg.cpp

示例12: LoadData

void CServer::LoadData()
{
	for (int i =0; i < g_LedInfos.GetCount(); i++)
	{
		delete g_LedInfos.GetAt(i);
	}
	g_LedInfos.RemoveAll();

	_RecordsetPtr rs = g_DB.GetRecordset(_T("SELECT * FROM LEDInfo"));
	while(!rs->adoEOF)
	{
		LED_INFO *pLedInfo = new LED_INFO;
		CString sTemp;
		if (rs->GetCollect(_T("Address")).vt != VT_NULL)
		{
			pLedInfo->sAddress = (LPCSTR)(_bstr_t)rs->GetCollect(_T("Address"));
		}

		if (rs->GetCollect(_T("Groups")).vt != VT_NULL)
		{
			pLedInfo->sGroups = (LPCSTR)(_bstr_t)rs->GetCollect(_T("Groups"));
		}

		if (rs->GetCollect(_T("Direction")).vt != VT_NULL)
		{
			pLedInfo->sDirection = (LPCSTR)(_bstr_t)rs->GetCollect(_T("Direction"));
		}

		if (rs->GetCollect(_T("ParkingLotNum")).vt != VT_NULL)
		{
			pLedInfo->uParkingLotNum = _ttoi((LPCSTR)(_bstr_t)rs->GetCollect(_T("ParkingLotNum")));
		}

		if (rs->GetCollect(_T("TextFormat")).vt != VT_NULL)
		{
			pLedInfo->sTextRgb = (LPCSTR)(_bstr_t)rs->GetCollect(_T("TextFormat"));
			
		}

		if (rs->GetCollect(_T("TagFormat")).vt != VT_NULL)
		{
			pLedInfo->sTagRgb = (LPCSTR)(_bstr_t)rs->GetCollect(_T("TagFormat"));
		}

		if (rs->GetCollect(_T("ComNum")).vt != VT_NULL)
		{
			pLedInfo->nComNum = _ttoi((LPCSTR)(_bstr_t)rs->GetCollect(_T("ComNum")));
		}

		g_LedInfos.Add(pLedInfo);
		rs->MoveNext();
	}
	rs->Close();

	g_bLedChange = FALSE;

	//rs = g_DB.GetRecordset(_T("SELECT * FROM GroupInfo"));
	//while(!rs->adoEOF)
	//{
	//	GROUP_INFO *pGroupInfo = new GROUP_INFO;
	//	CString sTemp;
	//	if (rs->GetCollect(_T("GroupID")).vt != VT_NULL)
	//	{
	//		pGroupInfo->sGroupID = (LPCSTR)(_bstr_t)rs->GetCollect(_T("GroupID"));
	//	}

	//	if (rs->GetCollect(_T("LedAddress")).vt != VT_NULL)
	//	{
	//		pGroupInfo->sLedAddress = (LPCSTR)(_bstr_t)rs->GetCollect(_T("LedAddress"));
	//	}

	//	if (rs->GetCollect(_T("Effective")).vt != VT_NULL)
	//	{
	//		pGroupInfo->nEffective = _ttoi((LPCSTR)(_bstr_t)rs->GetCollect(_T("Effective")));
	//	}

	//	if (rs->GetCollect(_T("RedLightNum")).vt != VT_NULL)
	//	{
	//		pGroupInfo->nRedLightNum = _ttoi((LPCSTR)(_bstr_t)rs->GetCollect(_T("RedLightNum")));

	//	}

	//	if (rs->GetCollect(_T("GreenLightNum")).vt != VT_NULL)
	//	{
	//		pGroupInfo->nGreenLightNum = _ttoi((LPCSTR)(_bstr_t)rs->GetCollect(_T("GreenLightNum")));
	//	}

	//	if (rs->GetCollect(_T("RGLightNum")).vt != VT_NULL)
	//	{
	//		pGroupInfo->nRGLightNum = _ttoi((LPCSTR)(_bstr_t)rs->GetCollect(_T("RGLightNum")));
	//	}

	//	if (rs->GetCollect(_T("NoneLightNum")).vt != VT_NULL)
	//	{
	//		pGroupInfo->nNoneLightNum = _ttoi((LPCSTR)(_bstr_t)rs->GetCollect(_T("NoneLightNum")));
	//	}

	//	g_GroupInfos.Add(pGroupInfo);
	//	rs->MoveNext();
	//}
//.........这里部分代码省略.........
开发者ID:chepaiTeam,项目名称:Garage,代码行数:101,代码来源:Server.cpp

示例13: STCPRecvThread

void CServer::STCPRecvThread(LPVOID pParam)
{
	clientdata *pcdata = (clientdata *)pParam;
	// 循环接收client端的连接请求
	char g_szBuff[MAX_PACKET_SIZE + 1];

	while(g_bAppRun)
	{
		memset(g_szBuff, 0, sizeof(g_szBuff));
		int nRecv = ::recv(pcdata->sClient, g_szBuff, MAX_PACKET_SIZE + 1, 0);
		if (nRecv == 0 || nRecv == SOCKET_ERROR)
		{
			TCHAR("客服端关闭");
			break;
		}
		if (nRecv > 0)
		{
			g_szBuff[nRecv] = '\0';
		}

		// 解析命令
		CCSDef::TMSG_HEADER* pMsgHeader = (CCSDef::TMSG_HEADER*)g_szBuff;

		switch (pMsgHeader->cMsgID)
		{
		case MSG_LEDINFO: 
			{
				//OpenFileError(pMsgHeader);
			}
			break;
		case MSG_DEVICEINFO:
			{
				CCSDef::TMSG_GROUPINFO* pGroupInfoMsg = (CCSDef::TMSG_GROUPINFO*)pMsgHeader;

				//添加或修改设备信息
				DEVICE_INFO *DeviceInfo = NULL;
				BOOL bFlag = FALSE;
				for (int i = 0; i < g_DeviceInfos.GetCount(); i++)
				{
					if(g_DeviceInfos.GetAt(i)->sIP == inet_ntoa(pcdata->ClientAddr.sin_addr))
					{
						DeviceInfo = g_DeviceInfos.GetAt(i);
						bFlag = TRUE;
					}
				}
				if (!bFlag)
				{
					DeviceInfo = new DEVICE_INFO;
					DeviceInfo->sIP = inet_ntoa(pcdata->ClientAddr.sin_addr);
					g_DeviceInfos.Add(DeviceInfo);
				}

				//添加或修改组信息
				GROUP_INFO *GroupInfo = NULL;
				bFlag = FALSE;
				for (int i = 0; i < DeviceInfo->aGroupInfos.GetCount(); i++)
				{
					if(DeviceInfo->aGroupInfos.GetAt(i)->sGroupID == pGroupInfoMsg->szGroupID)
					{
						GroupInfo = DeviceInfo->aGroupInfos.GetAt(i);
						bFlag = TRUE;
					}
				}
				if (!bFlag)
				{
					GroupInfo = new GROUP_INFO;
					GroupInfo->sGroupID = pGroupInfoMsg->szGroupID;
					DeviceInfo->aGroupInfos.Add(GroupInfo);
				}
				GroupInfo->nEffective = 1;
				GroupInfo->nGreenLightNum = pGroupInfoMsg->nGreenLightNum;
				GroupInfo->nNoneLightNum = pGroupInfoMsg->nNoneLightNum;
				GroupInfo->nRedLightNum = pGroupInfoMsg->nRedLightNum;
				GroupInfo->nRGLightNum = pGroupInfoMsg->nRGLightNum;

				//nRedLightNum = 0;
				//nGreenLightNum = 0;
				//nRGLightNum = 0;
				//nNoneLightNum = 0;
				////遍历设备中与该组相关的信息
				//for (int i = 0; i < g_DeviceInfos.GetCount(); i++)
				//{
				//	DeviceInfo = g_DeviceInfos.GetAt(i);
				//	for (int j = 0; j < DeviceInfo->aGroupInfos.GetCount(); j++)
				//	{
				//		GroupInfo = DeviceInfo->aGroupInfos.GetAt(j);
				//		if (GroupInfo->sGroupID == pGroupInfoMsg->szGroupID)
				//		{
				//			nRedLightNum += GroupInfo->nRedLightNum;
				//			nGreenLightNum += GroupInfo->nGreenLightNum;
				//			nNoneLightNum += GroupInfo->nNoneLightNum;
				//			nRGLightNum += GroupInfo->nRGLightNum;
				//		}
				//	}
				//}

				//CString sSql;
				//sSql.Format(_T("UPDATE GroupInfo SET RedLightNum = %d, GreenLightNum = %d, NoneLightNum = %d, RGLightNum = %d WHERE GroupID = '%s'"),
				//	nRedLightNum, nGreenLightNum, nNoneLightNum, nRGLightNum, pGroupInfoMsg->szGroupID);
				//g_DB.ExecuteSQL((_bstr_t)sSql);
//.........这里部分代码省略.........
开发者ID:chepaiTeam,项目名称:Garage,代码行数:101,代码来源:Server.cpp

示例14: BroadcastThread

void CServer::BroadcastThread(LPVOID pParam)
{
	int i, j, k;
	LED_INFO *pLedInfo;
	CString str1, str2;
	CString sSql;
	int nTem;

	int nRedLightNum;
	int nGreenLightNum;
	int nRGLightNum;
	int nNoneLightNum;

	DEVICE_INFO *DeviceInfo = NULL;
	GROUP_INFO *GroupInfo = NULL;

	CString s1, s2;
	int nS1 = 0, nS2 = 0;

	while(g_bAppRun)
	{
		//如果数据改变则重新加载
		if (g_bLedChange)
			LoadData();

		// 把数据广播出去
		CCSDef::TMSG_LEDINFO tMsgLedInfo;
		for (i = 0; i < g_LedInfos.GetCount(); i++)
		{
			pLedInfo = g_LedInfos.GetAt(i);

			nRedLightNum = 0;
			nGreenLightNum = 0;
			nRGLightNum = 0;
			nNoneLightNum = 0;
			if (pLedInfo->sGroups != "")
			{
				nS1 = 0;
				while(AfxExtractSubString(s1, pLedInfo->sGroups, nS1, ';'))
				{
					//遍历设备中与该组相关的信息
					for (j = 0; j < g_DeviceInfos.GetCount(); j++)
					{
						DeviceInfo = g_DeviceInfos.GetAt(j);
						for (k = 0; k < DeviceInfo->aGroupInfos.GetCount(); k++)
						{
							GroupInfo = DeviceInfo->aGroupInfos.GetAt(k);
							if (GroupInfo->sGroupID == s1)
							{
								nRedLightNum += GroupInfo->nRedLightNum;
								nGreenLightNum += GroupInfo->nGreenLightNum;
								nNoneLightNum += GroupInfo->nNoneLightNum;
								nRGLightNum += GroupInfo->nRGLightNum;
							}
						}
					}
					nS1++;
				}
			}
			
			//nRedNum = 0;
			//sSql.Format(_T("SELECT SUM(RedLightNum) AS RedLightNum1 FROM GroupInfo WHERE LedAddress = '%s'"), pLedInfo->sAddress);
			//_RecordsetPtr rs = g_DB.GetRecordset((_bstr_t)sSql);
			//while(!rs->adoEOF)
			//{
			//	if (rs->GetCollect(_T("RedLightNum1")).vt != VT_NULL)
			//	{
			//		nTem = _ttoi((LPCSTR)(_bstr_t)rs->GetCollect(_T("RedLightNum1")));
			//		if (nTem > 0)
			//		{
			//			nRedNum += nTem;
			//		}
			//	}
			//	rs->MoveNext();
			//}
			//rs->Close();

			nTem = pLedInfo->uParkingLotNum - nRedLightNum;

			str1.Format(_T("%[email protected]%[email protected]%[email protected]%[email protected]%[email protected]%d"), pLedInfo->sAddress, pLedInfo->sDirection,
				nTem > 0 ? nTem : 0, pLedInfo->sTextRgb, pLedInfo->sTagRgb, pLedInfo->nComNum);
			if (i == 0)
			{
				str2 = str1;
			}else
			{
				str2 += _T("$") + str1;
			}
		}
		strcpy(tMsgLedInfo.szBuff, str2);

		SOCKADDR_IN dstAdd; 
		dstAdd.sin_family = AF_INET; 
		dstAdd.sin_port = htons(CAST_PORT);
		dstAdd.sin_addr.s_addr = INADDR_BROADCAST;
		if(SOCKET_ERROR == ::sendto(g_sCastSend, (char*)(&tMsgLedInfo), sizeof(CCSDef::TMSG_GROUPINFO), 0, (SOCKADDR*)&dstAdd, sizeof(SOCKADDR)))
		{
			TRACE("Send Data Error!\n");
			return;
		}
//.........这里部分代码省略.........
开发者ID:chepaiTeam,项目名称:Garage,代码行数:101,代码来源:Server.cpp

示例15: initializeIndexDatabase

/*-----------------------------------------CIRexxApp::initializeIndexDatabase-+
|                                                                             |
+----------------------------------------------------------------------------*/
void CIRexxApp::initializeIndexDatabase()
{
   m_isScriptIndexDBInitialized = true;

   Err err;
   char categoryName[dmCategoryLength];

   // Open MemoPad's DB as a source for scripts.
   m_memoDB = new CDatabase(
      0, "MemoDB", sysFileCMemo, 'data', false, false, dmModeReadOnly
   );
   for (m_memoCategory = 0; m_memoCategory < dmRecNumCategories; ++m_memoCategory) {
       CategoryGetName(m_memoDB->GetDatabasePtr(), m_memoCategory, categoryName);
       if (!StrCaselessCompare(categoryName, "REXX")) { break; }
   }
   if (m_memoCategory == dmRecNumCategories ||
       m_memoDB->NumRecordsInCategory(m_memoCategory) == 0) {
       delete m_memoDB;
       m_memoDB = 0;
   }

   //<<<JAL TODO:  I think CategoryGetName() will core dump
   // if the db has no categories.  So, we should probably
   // check the db attrs before doing this.


   // Open pedit's DB as a source for scripts.
   // Since this DB may not exist (unlike MmeoPad's)
   // then Open() or CategoryGetName() may throw an exception
   // that we'll have to handle properly.
   try {
      m_pedit32DB = new CDatabase();
      err = m_pedit32DB->Open(0, "Memo32DB", dmModeReadOnly);
      for (m_pedit32Category = 0; m_pedit32Category < dmRecNumCategories; ++m_pedit32Category) {
          CategoryGetName(m_pedit32DB->GetDatabasePtr(), m_pedit32Category, categoryName);
          if (!StrCaselessCompare(categoryName, "REXX")) { break; }
      }
      if (m_pedit32Category == dmRecNumCategories ||
          m_pedit32DB->NumRecordsInCategory(m_pedit32Category) == 0) {
         delete m_pedit32DB;
         m_pedit32DB = 0;
      }
   } catch (...) {
       delete m_pedit32DB;
       m_pedit32DB = 0;
   }

   // Open our own DB as a source for scripts.
   try {
      m_rexxDB = new CDatabase();
      err = m_rexxDB->Open(0, "RexxDB", dmModeReadOnly);
      for (m_rexxCategory = 0; m_rexxCategory < dmRecNumCategories; ++m_rexxCategory) {
          CategoryGetName(m_rexxDB->GetDatabasePtr(), m_rexxCategory, categoryName);
          if (!StrCaselessCompare(categoryName, "REXX")) { break; }
      }
      if (m_rexxCategory == dmRecNumCategories ||
          m_rexxDB->NumRecordsInCategory(m_rexxCategory) == 0) {
         delete m_rexxDB;
         m_rexxDB = 0;
      }
   } catch (...) {
       delete m_rexxDB;
       m_rexxDB = 0;
   }

   if (m_memoDB == 0 && m_pedit32DB == 0 && m_rexxDB == 0) { return; }

   // Create an index and then index each database so that we can
   // serialize the index into a actual POL database for grid mapping.
   CArray<ScriptRecord *> records;

   addRecordsToIndex(records, m_pedit32DB, m_pedit32Category, "P");
   addRecordsToIndex(records, m_memoDB, m_memoCategory, "M");
   addRecordsToIndex(records, m_rexxDB, m_rexxCategory, "R");

   m_scriptIndexDB = new CDatabase(0, "RexxScriptIndexDB", CREATORID, 'temp');
   m_scriptIndexDB->RemoveAllRecords();
   for (int i = 0; i < records.GetCount(); ++i) {
      ScriptRecord * sr = records[i];
      CRecordStream rs(m_scriptIndexDB);
      rs << sr->m_title;  //<<<JAL TODO:  YUCK!  MOVE ACCESS TO ScriptRecord CLASS!
      rs << sr->m_dbi;
      rs << (UInt32)sr->m_db;
      rs << sr->m_indexes.GetCount();
      for (int j = 0; j < sr->m_indexes.GetCount(); ++j) {
         rs << sr->m_indexes[j] << sr->m_segments[j];
      }
   }
   for (int i = 0; i < records.GetCount(); ++i) {
      delete records[i];
   }
   return;
}
开发者ID:Jaxo,项目名称:yaxx,代码行数:96,代码来源:IRexxApp.cpp


注:本文中的CArray::GetCount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。