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

	for (int i =0; i < g_DeviceInfos.GetCount(); i++)
	{
		for (int j = 0; j < g_DeviceInfos.GetAt(i)->aGroupInfos.GetCount(); j++)
		{
			delete g_DeviceInfos.GetAt(i)->aGroupInfos.GetAt(j);
		}
		delete g_DeviceInfos.GetAt(i);
	}
	g_DeviceInfos.RemoveAll();
	

	//for (int i =0; i < g_GroupInfos.GetCount(); i++)
	//{
	//	delete g_GroupInfos.GetAt(i);
	//}
	//g_GroupInfos.RemoveAll();
	//CloseSocket();
}
Example #2
0
void DLrtfhtml::addHtmlTagToStr(CString &str,CArray<rtfProperty,rtfProperty&> &proArr)
{
	CString temp,tag,dtag;
	int i;
	for(i=0;i<proArr.GetCount();i++)
	{//添加单标记属性
		if(proArr.GetAt(i).single==TRUE)
		{
			tag+=proArr.GetAt(i).htmlTagB;
			tag+=_T(" ");
			//tag.Format(_T(" %s %s"),tag,proArr.GetAt(i).htmlTagB);
		}
	}
	//添加双标记
	dtag=str;
	for(i=0;i<proArr.GetCount();i++)
	{
		if(proArr.GetAt(i).single!=TRUE)
		{
			dtag.Format(_T("%s%s%s"),proArr.GetAt(i).htmlTagB,dtag,proArr.GetAt(i).htmlTagE);
		}
	}
	if(!tag.IsEmpty())
	{
		temp.Format(_T("<span style=\"%s\" >"),tag);
		temp+=dtag;
		temp+=_T("</span>");
		str=temp;
	}
	else
		str=dtag;
	
}
Skein::Node* TranscriptWindow::FindRelevantNode(FindAction action, bool next, bool selected)
{
    // Get all the nodes in the transcript or skein
    CArray<Skein::Node*,Skein::Node*> nodes;
    if (action == SkeinDifferent)
    {
        ASSERT(next);
        m_skein->GetAllNodes(nodes);
    }
    else
    {
        Skein::Node* node = m_skeinEndThread;
        while (node != NULL)
        {
            if (next)
                nodes.InsertAt(0,node);
            else
                nodes.Add(node);
            node = node->GetParent();
        }
    }
    if (next)
        nodes.InsertAt(0,(Skein::Node*)NULL);

    // Return the next relevant node after the selected node (which may be NULL)
    bool afterSelected = false;
    for (int i = 0; i < nodes.GetSize(); i++)
    {
        if (afterSelected == false)
        {
            if (nodes.GetAt(i) == (selected ? m_skeinSelected : NULL))
                afterSelected = true;
        }
        else
        {
            switch (action)
            {
            case TranscriptDifferent:
            case SkeinDifferent:
                if (nodes.GetAt(i)->GetDiffers() != Skein::Node::ExpectedSame)
                    return nodes.GetAt(i);
                break;
            case TranscriptChanged:
                if (nodes.GetAt(i)->GetChanged())
                    return nodes.GetAt(i);
                break;
            default:
                ASSERT(FALSE);
                break;
            }
        }
    }

    // If nothing found, then if searching the whole skein, start from the beginning
    if ((action == SkeinDifferent) && selected)
        return FindRelevantNode(action,next,false);
    return NULL;
}
Example #4
0
// 将OpenCV图像显示到控件上
void	CJudgeDlg::DrawPicture2HDC()
{
	m_matImage = LoadFOVImage2Color(m_pDocument->GetDirectory(), m_nFOVIndex);
	if ( !m_matImage.empty() )
	{
		CArray<CvRect, CvRect>* pRect;
		CvRect cvRect;
		CvPoint pt1, pt2;
		int i;
		//pRect = m_pDocument->GetTargetInfoInFOV(m_nWorkPosition, m_nFOVIndex);
		//for ( i = 0; i < pRect->GetSize(); i++ )
		//{				
		//	cvRect = pRect->GetAt(i);
		//	pt1.x = cvRect.x;
		//	pt1.y = cvRect.y;
		//	pt2.x = cvRect.x + cvRect.width;
		//	pt2.y = cvRect.y + cvRect.height;
		//	cvRectangle(m_pcvImage, pt1, pt2, CV_RGB(255,0,0), 2, 8,0);
		//}
				
		pRect = m_pDocument->GetSimpleTargetInfoInFOV(m_nFOVIndex);
		for ( i = 0; i < pRect->GetSize(); i++ )
		{				
			cvRect = pRect->GetAt(i);
			pt1.x = cvRect.x;
			pt1.y = cvRect.y;
			pt2.x = cvRect.x + cvRect.width;
			pt2.y = cvRect.y + cvRect.height;
			cv::rectangle(m_matImage, pt1, pt2, CV_RGB(255,0,0), 2, 8,0);
		}
		pRect = m_pDocument->GetOverlapTargetInfoInFOV( m_nFOVIndex);
		for ( i = 0; i < pRect->GetSize(); i++ )
		{				
			cvRect = pRect->GetAt(i);
			pt1.x = cvRect.x;
			pt1.y = cvRect.y;
			pt2.x = cvRect.x + cvRect.width;
			pt2.y = cvRect.y + cvRect.height;
			cv::rectangle(m_matImage, pt1, pt2, CV_RGB(0,255,0), 2, 8,0);
		}

		UINT ID = IDC_FOV_IMAGE;
		
		CDC *pDC = this->GetDlgItem(ID)->GetDC();
		HDC hDC = pDC->GetSafeHdc();

		CRect	rect;
		this->GetDlgItem(ID)->GetClientRect(&rect);
		
		CMyBitmap bmp;
		bmp.CopyFromMat(m_matImage);
		bmp.Draw(hDC,rect,1,0,0);

		ReleaseDC(pDC);	
	}	
}
Example #5
0
///
///	@brief	구조체 배열에 저장되어 있는 자식 IE에 인젝트된 DLL을 이젝트
///
void EjectDLLToControlProcess()
{
	CString strDLL;
	HANDLE	hProcess;

	for(int i = 0; i < g_ArrInjectProcess.GetCount(); i++)
	{
		strDLL = g_ArrInjectProcess.GetAt(i).strDLL;
		hProcess = g_ArrInjectProcess.GetAt(i).hProcess;

		UninjectLibrary(strDLL, hProcess);
	}
}
Example #6
0
void CDlgSpeedTest::Init()
{
	m_cList.DeleteAllItems();
	CArray<CommInfo*,CommInfo*> *pSite = g_pDoLogin->m_commData.GetSysServerInfo();
	CArray<CommInfo*,CommInfo*> *pSiteUsr = g_pDoLogin->m_commData.GetUsrServerInfo();
	int sel = m_cTabCtl.GetCurSel();
	switch (sel)
	{
	case 0:
		m_cType = CEV_Connect_HQ;
		break;
	case 1:
		m_cType = CEV_Connect_JY;
		break;
	}
	m_nNotiCount = 0;
	m_nTotalCount = 0;
 	if (pSite)
 	{
 		for (int i=0; i<pSite->GetCount(); i++)
 		{
 			CommInfo *pInfo = pSite->GetAt(i);
 			if (pInfo->m_cType == m_cType)
 			{
 				int n = m_cList.GetItemCount();
				m_nTotalCount++;
				m_cList.InsertItem(n,pInfo->m_strServerID);
				m_cList.SetItemText(n,1,"...");
				m_cList.SetItemText(n,2,"...");
				m_cList.SetItemText(n,3,"...");
 			}
 		}
 	}
	if (pSiteUsr)
	{
		for (int i=0; i<pSiteUsr->GetCount(); i++)
		{
			CommInfo *pInfo = pSiteUsr->GetAt(i);
			if (pInfo->m_cType == m_cType)
			{
				int n = m_cList.GetItemCount();
				m_nTotalCount++;
				m_cList.InsertItem(n,pInfo->m_strServerID);
				m_cList.SetItemText(n,1,"...");
				m_cList.SetItemText(n,2,"...");
				m_cList.SetItemText(n,3,"...");
			}
		}
	}
}
Example #7
0
void DoTestFiles(const char *filelist, const char *environment)
{
	if (!GetTestFiles(filelist)) {
		printf("No Files to test!\r\n");
		return;
	}

	Results.SetSize(IsapiFileList.GetSize());

	ReadGlobalEnvironment(environment);

	DoThreads();

	printf("\r\nRESULTS:\r\n");
	// show results:
	DWORD r = Results.GetSize();
	for (DWORD i=0; i< r; i++) {
		TResults result = Results.GetAt(i);
		printf("%s\r\nOK: %d FAILED: %d\r\n", TestNames.GetAt(i), result.ok, result.bad);
	}

	// delete temp files
	printf("Deleting Temp Files\r\n");
	DeleteTempFiles("exp.*");
	DeleteTempFiles("pht.*");
	printf("Done\r\n");
}
void CCalloutConfigDialog::SetCurrentPageInfo(int iDisplayTime) {
    int iActivePage = m_pEditorDoc->project.GetActivePage(iDisplayTime);
    if(iActivePage != m_iActivePage) {
        m_iActivePage = iActivePage;
    } else {
        return;
    }
    UINT nStartMs, nEndMs;
    CString csSeconds;
    csSeconds.LoadString(IDC_CALLOUT_TIME_SEC);
    m_pEditorDoc->project.GetPagePeriod(iDisplayTime, nStartMs, nEndMs);
    CString csLblText;
    csLblText.Format(_T("%.3f %s"), nStartMs / 1000.0, csSeconds);
    m_lblPageStart.SetWindowText(csLblText);
    csLblText.Format(_T("%.3f %s"), nEndMs / 1000.0, csSeconds);
    m_lblPageEnd.SetWindowText(csLblText);
    csLblText.Format(_T("%.3f %s"), (nEndMs - nStartMs) / 1000.0, csSeconds);
    m_lblPageLength.SetWindowText(csLblText);

    CArray<CPage*, CPage*> caPages;
    m_pEditorDoc->project.GetPages(caPages, iDisplayTime , iDisplayTime + 1);
    if(caPages.GetCount() > 0) {
        CString csTitle = caPages.GetAt(0)->GetTitle();
        m_lblPageName.SetWindowText(csTitle);
    }
}
Example #9
0
void CTobCompiler::Reset()
{
	m_line = 0;
	m_err.Empty();
	m_bin.RemoveAll();
	if(m_fsrc) { fclose(m_fsrc); m_fsrc = 0; }
	if(m_fdst) { fclose(m_fdst); m_fdst = 0; }

	POSITION p = m_defbin.GetStartPosition();
	CString str;
	CByteArray* bin;
	while(p)
	{
		m_defbin.GetNextAssoc(p, str, bin);
		delete bin;
	}
	m_defbin.RemoveAll();
	m_defbin.InitHashTable(251);

	m_label.RemoveAll();
	m_label.InitHashTable(251);
	for(int i = m_exp.GetSize() - 1; i >= 0; --i)
		delete m_exp.GetAt(i);
	m_exp.RemoveAll();
	m_change.RemoveAll();
	m_change.InitHashTable(251);
	m_bit_i = 32;
	m_bit_f = 32;
	m_maxc = -1;
	m_maxw = -1;
	m_maxs = -1;
}
Example #10
0
void CRegistry::DeleteKey(HKEY hParent, LPCTSTR pszKey)
{
	HKEY hKey;
	if ( RegOpenKeyEx( hParent, pszKey, 0, KEY_ALL_ACCESS, &hKey ) ) return;

	CArray< CString > pList;

	for ( DWORD nIndex = 0 ; ; nIndex++ )
	{
		DWORD dwName = 64;	// Input parameter in TCHARs
		TCHAR szName[64];

		LRESULT lResult = RegEnumKeyEx( hKey, nIndex, szName, &dwName, NULL, NULL, 0, NULL );
		if ( lResult != ERROR_SUCCESS ) break;

		szName[ dwName ] = 0;
		pList.Add( szName );
		DeleteKey( hKey, szName );
	}

	for ( int nItem = pList.GetSize() - 1 ; nItem >= 0 ; nItem-- )
	{
		RegDeleteKey( hKey, pList.GetAt( nItem ) );
	}

	if ( lstrlen( pszKey ) > 25 )	// Handle likely initial non-recursive value
		RegDeleteKey( HKEY_CURRENT_USER, pszKey );

	RegCloseKey( hKey );
}
// Takes a connected computer to ignore, and a GUID (do)
// Randomly chooses a neighbour from amongst those that are connected, running Gnutella2, hubs, and don't know about the GUID
// Returns a pointer to that randomly selected neighbour
CG2Neighbour* CNeighboursWithG2::GetRandomHub(CG2Neighbour* pExcept, const Hashes::Guid& oGUID)
{
	// Make a new local empty list that will hold pointers to neighbours
	CArray< CG2Neighbour* > pRandom;

	// Loop through each computer we're connected to
	for ( POSITION pos = GetIterator() ; pos ; )
	{
		// Get the neighbour under the current position, and move to the next one in the list
		CNeighbour* pNeighbour = GetNext( pos );

		// If this is a Gnutella2 hub
		if ( pNeighbour->m_nState == nrsConnected   &&	// We've finished the handshake with this computer, and
			 pNeighbour->m_nProtocol == PROTOCOL_G2 &&	// It's running Gnutella2 software, and
			 pNeighbour->m_nNodeType != ntLeaf      &&	// Our connection to it isn't down to a leaf, and
			 pNeighbour != pExcept )					// It's not the one the caller told us to avoid
		{
			// And it doesn't know the given GUID, add it to the random list
			if ( static_cast< CG2Neighbour* >( pNeighbour )->m_pGUIDCache->Lookup( oGUID ) == NULL )
				pRandom.Add( static_cast< CG2Neighbour* >( pNeighbour ) );
		}
	}

	// If we didn't find any neighbours to put in the list, return null
	INT_PTR nSize = pRandom.GetSize();
	if ( ! nSize ) return NULL;

	// Choose a random number between 0 and nSize - 1, use it as an index, and return the neighbour at it
	nSize = GetRandomNum< INT_PTR >( 0, nSize - 1 );
	return pRandom.GetAt( nSize );
}
Example #12
0
	// ----- zhfzhftool._dttk command (do not rename)
	static void zhfzhftool_dttk(void)
	{
		// Add your code for command zhfzhftool._dttk here
		if (g_bIsTukuFirst)
		{
			InitApplication() ;
		}
		else
		{
			CMDIFrameWnd* pAcadFrame  = acedGetAcadFrame();

			if (g_pArrayZhfPaletteSet.GetCount()>1)
			{
				CZhfPaletteSet* pSet = g_pArrayZhfPaletteSet.GetAt(1) ;
				if (pSet->IsWindowVisible())
				{
					pAcadFrame->ShowControlBar(pSet, FALSE, FALSE);
				}
				else
				{
					pAcadFrame->ShowControlBar(pSet, TRUE, FALSE);
				}	
			}
			else
			{
				acutPrintf(_T("\n图库面板没有创建或创建失败,无法显示!")) ;
			}
		}
	}
Example #13
0
void CUserDlg::BindAllUserToListBox()
{
	UpdateData(TRUE);

	m_lsbUserList.ResetContent();

	MailUser* mailU=new MailUser();
	CString userStr;
	CArray<MailUser,MailUser&>* mailUsers =mailU->GetAllUsers();

	int numberUser=mailUsers->GetCount();

	if ((mailUsers != NULL) &&numberUser!=NULL)
		{

			//CString result;
			//result=mailUsers->GetAt(1)._username;
		for (int i=0;i<numberUser;i++)
		{
		
			userStr.Format("%s",mailUsers->GetAt(i)._username);
			m_lsbUserList.AddString(userStr);
		}
	}
	UpdateData(FALSE);
}
Example #14
0
// -----------------------------------------------------------//
// Function:    CModifyMemoryDlg::GetProcessInfo
// Param                
// Return  :    void    
// meaning :    �l������M�� 
// -----------------------------------------------------------//
void    CModifyMemoryDlg::GetProcessInfo()
{
    m_ProcessList.DeleteAllItems();

    // �l������M��
    CArray<PROCESSENTRY32_, PROCESSENTRY32_> processList;
    FlushProcessInfo(processList);
    int nSize = processList.GetCount();
    for(int i = 0; i < nSize; i++)
    {
        PROCESSENTRY32_ entry = processList.GetAt(i);
        m_ProcessList.InsertItem(i, "");
        // SetValue
        CString str(entry.szExeFile);
        m_ProcessList.SetItemText(i, 0, str);
        str.Format("%d", entry.th32ProcessID);
        m_ProcessList.SetItemText(i, 1, str);
        str.Format("%d", entry.th32ParentProcessID);
        m_ProcessList.SetItemText(i, 2, str);
        str.Format("%d", entry.th32ModuleID);
        m_ProcessList.SetItemText(i, 3, str);
        str.Format("%d", entry.cntThreads);
        m_ProcessList.SetItemText(i, 4, str);
    }
}
Example #15
0
//===========================================================================
void CFAVConnectDlg::OnBnClickedConnectCheck()
//===========================================================================
{
	// TODO: Add your control notification handler code here
	CArray<CString,CString> strArrayCOM;
	UINT	uPortCount;
	CComboBox* pCbox = (CComboBox*)GetDlgItem(IDC_CONNECT_COMSEL);
	CString strCOMPORT;
	if(m_bCOMSel){
		GetDlgItem(IDC_CONNECT_COMSEL)->EnableWindow(FALSE);
		m_bGetSerialPort = FALSE;
		for(UINT i = pCbox->GetCount(); i > 0; i--){
			pCbox->DeleteString(i-1);
		}
		m_bCOMSel = FALSE;
	}
	else{
		if(!m_bGetSerialPort){
			m_bGetSerialPort = TRUE;
			uPortCount = m_UARTComm.GetSerialPort(TRUE, strArrayCOM);
			for(UINT i = 0; i < uPortCount; i++){
				strCOMPORT = strArrayCOM.GetAt(m_UARTComm.GetCOMIndex(i));
				pCbox->InsertString(i,strCOMPORT);
			}
			pCbox->SetCurSel(0);
		}
		GetDlgItem(IDC_CONNECT_COMSEL)->EnableWindow(TRUE);
		m_bCOMSel = TRUE;
	}
}
Example #16
0
void CByteStreamReader::SetData(CArray<BYTE> &pdata)
{
	m_buffer.RemoveAll();
	for(int i = 0; i < pdata.GetCount(); ++i)
	{
		m_buffer.Add(pdata.GetAt(i));
	}
}
Example #17
0
void Cv11View::OnShape()
{
	CArray<CMFCRibbonBaseElement*, CMFCRibbonBaseElement*> arr;
	((CMainFrame*)AfxGetMainWnd())->m_wndRibbonBar.GetElementsByID(ID_SHAPE, arr);
	CMFCRibbonGallery* pGallery = (CMFCRibbonGallery*)arr.GetAt(0);
	shape = pGallery->GetSelectedItem();
	shape1 = shape;
	Invalidate();
}
Example #18
0
void Cv11View::OnColor()
{
	CArray<CMFCRibbonBaseElement*, CMFCRibbonBaseElement*> arr;
	((CMainFrame*)AfxGetMainWnd())->m_wndRibbonBar.GetElementsByID(ID_COLOR, arr);
	CMFCRibbonColorButton* pGallery = (CMFCRibbonColorButton*)arr.GetAt(0);
	color = pGallery->GetColor();
	color1 = color;
	Invalidate();
}
Example #19
0
int DLrtfhtml::proIsExist(CString str,CArray<rtfProperty,rtfProperty&> &proArr)
{
	for(int j=0;j<proArr.GetCount();j++)
	{
		if(str.Compare(proArr.GetAt(j).rtfType)==0)
			return j;
	}
	return -1; //not exist
}
Example #20
0
void CzhftoolApp::UnloadApplication(void)
{
	for (int i=0; i<g_pArrayZhfPaletteSet.GetCount(); i++)
	{
		CZhfPaletteSet* pSet = g_pArrayZhfPaletteSet.GetAt(i) ;
		pSet->DestroyWindow() ;
		delete pSet ;
	}
}
Example #21
0
void Cv11View::OnColor()
{
	CArray<CMFCRibbonBaseElement*, CMFCRibbonBaseElement*> arr;
	((CMainFrame*)AfxGetMainWnd())->m_wndRibbonBar.GetElementsByID(ID_COLOR, arr);
	CMFCRibbonColorButton* pGalery = (CMFCRibbonColorButton*)arr.GetAt(0);
	color = pGalery->GetColor();
	color_t = color;
	Invalidate();
	// TODO: Add your command handler code here
}
Example #22
0
void CStockManager::MakeShortName(StockUserInfo *pStock)
{
	// 低位是汉字长度,高位是拼音长度
	short nPyjc = 0;

	CString StockName = pStock->GetName(TRUE);
	StockInfoEx *pStockEx = GetStockInfoEx(&pStock->m_ciStockCode);
	memcpy(&pStock->m_cShortPyjc[12], &pStockEx, sizeof(StockInfoEx *));

	int i = 0;
	int bufsz = 0;
	CArray<CStringArray*,CStringArray*> ay;
	CStringArray* pItem;
	char *s = StockName.GetBuffer(StockName.GetLength());

	while(i < StockName.GetLength())
	{
		pItem = GetPyjcByHZ(s,i);
		ay.Add(pItem);
		bufsz += pItem->GetSize();
		if(pItem->GetSize() > 1)
			bufsz++;
	}

	StockName.ReleaseBuffer();

	if(ay.GetSize())
	{
		int j = 0;
		pStockEx->pPyjcArray = new CString;
		LPSTR pBuffer = pStockEx->pPyjcArray->GetBufferSetLength(bufsz + 1);
		for(i = 0; i < ay.GetSize(); i++)
		{
			pItem = ay.GetAt(i);
			if(pItem->GetSize() > 1)
			{
				pBuffer[j++] = (char)pItem->GetSize();

				for(int k = 0; k < pItem->GetSize(); k++)
					pBuffer[j++] = pItem->GetAt(k).GetAt(0);
			}
			else if(pItem->GetSize())
			{
				char c = pItem->GetAt(0).GetAt(0);
				pBuffer[j++] = pItem->GetAt(0).GetAt(0);
			}
		}

		pStockEx->pPyjcArray->ReleaseBuffer(j);
	}

	_delArrayObj(ay);
}
Example #23
0
int CDrawQuoteTabCtrl::OpenAllMarketMenu(CPoint point )
{
	CDrawQuoteTab* pTab = m_ayItem[m_nCurItem];
	CString strCurItemName = pTab->m_strName;
	CArray<StockType> ayAllMarket;
	m_pDataSource->HSDataSourceEx_GetSystemMarketInfo(0, 0, ayAllMarket);

	short nPreMarket = 0;
	CMenu menu;
	menu.CreatePopupMenu();
	for (int i=0; i<ayAllMarket.GetCount(); i++)
	{
		if ((nPreMarket&0xFF00) != (ayAllMarket.GetAt(i).m_nStockType&0xFF00))
		{
			menu.AppendMenu(MF_SEPARATOR|MF_MENUBARBREAK);
		}
		menu.AppendMenu(MF_BYCOMMAND,CDRAWTAB_ID_MENU_MARKET_BEGIN+i,ayAllMarket.GetAt(i).m_stTypeName.m_szName);
		if (!strCurItemName.IsEmpty() && strCurItemName==ayAllMarket.GetAt(i).m_stTypeName.m_szName)
		{
			menu.CheckMenuItem(CDRAWTAB_ID_MENU_MARKET_BEGIN+i,MF_BYCOMMAND|MF_CHECKED);
		}

		CString strTemp;
		strTemp.Format("%s-%d",ayAllMarket.GetAt(i).m_stTypeName.m_szName,ayAllMarket.GetAt(i).m_nStockType);
		m_mapTempMenuIndex.SetAt(CDRAWTAB_ID_MENU_MARKET_BEGIN+i,strTemp);

		nPreMarket = (ayAllMarket.GetAt(i).m_nStockType&0xFF00);
	}

	CWnd* pWnd = m_pDrawTabNotify->TabGetCWnd();
	int nMenuID = menu.TrackPopupMenu(TPM_VERPOSANIMATION | TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD,point.x,point.y,pWnd);
	menu.DestroyMenu();
	return nMenuID;
}
Example #24
0
//===========================================================================
BOOL CFAVConnectDlg::COMContrast(CString str)
//===========================================================================
{
	CArray<CString,CString> strArrayCOM;
	UINT	uPortCount;

	uPortCount = m_UARTComm.GetSerialPort(TRUE, strArrayCOM);
	for(UINT i = 0; i < uPortCount; i++){
		if(str == strArrayCOM.GetAt(m_UARTComm.GetCOMIndex(i)))
			return TRUE;
	}
	return FALSE;
}
Example #25
0
int CProxy::ValidateRequest(int playlistpos)
{
	int		requestsOnQueue = 0;

	if (playlistpos < 0) {
		return ERR_POSITION_OUT_OF_RANGE;
	}
	if (playlistpos > PlaylistFileCache.GetSize()) {
		return ERR_POSITION_OUT_OF_RANGE;
	}
	/* Validate Queue Size Check */
	if (RequestQueue.GetSize() >= atoi(g_MaxQueueSize)) {
		return ERR_QUEUE_FULL;
	}

	/* Validate MAX from IP Check */
	for(int i=0;i<=RequestQueue.GetUpperBound();i++) {
		if (RequestQueue.GetAt(i).requestingIP == connectedTo) {
			requestsOnQueue++;
		}
	}
	if (atoi(g_MaxRequestsPerIP) != 0) {
		if (requestsOnQueue >= atoi(g_MaxRequestsPerIP)) {
			return ERR_MAX_REQUEST_IP;
		}
	}

	int identicalOnQueue = 0;
	for(i=0;i<=RequestQueue.GetUpperBound();i++) {
		if (RequestQueue.GetAt(i).playlistpos == playlistpos) {
			identicalOnQueue++;
		}
	}
	if (identicalOnQueue > 0) {
		return ERR_TOO_MANY_CONSECUTIVE_ALL;
	}
	return REQUEST_ACCEPTED;
}
Example #26
0
void CGraph::PreviewDxfGraph()
{
	PrepareDraw();

	m_hOldDrawPointPen = (HPEN)::SelectObject(m_hMemDC, m_hDrawPointPen);
	for(int i = 0; i < g_ptrGraphArray.GetSize(); ++i)
	{
		(g_ptrGraphArray.GetAt(i))->Draw(m_hMemDC, CRect(0, 0, m_cxStaticWidth, m_cxStaticWidth), FRAME_EDAGE_OFFSET);
	}
	::SelectObject(m_hMemDC, m_hOldDrawPointPen);
	::BitBlt(m_hGraphDC, 0, 0, m_cxStaticWidth, m_cyStaticHeight, m_hMemDC, 0, 0, SRCCOPY);

	OverDraw();
}
Example #27
0
void CCompileEditView::InitData()
{
	if( m_pExternExpression != NULL ||
		m_pExternVariabile  != NULL || 
		m_pExternFunction   != NULL )
		return;
		
	CArray<CMapVariabile*,CMapVariabile*>* ayData = NULL;
	if( g_hParentWnd && 
		(ayData = (CArray<CMapVariabile*,CMapVariabile*>*)::SendMessage( g_hParentWnd,HX_USER_COMPILEDATA,0,0)) != NULL )
	{
		if( ayData != NULL && ayData->GetSize() >= 3 ) 
		{
			m_pExternExpression = ayData->GetAt(0);  // 外部表达式表
			m_pExternVariabile  = ayData->GetAt(1);	 // 外部变量表
			m_pExternFunction   = ayData->GetAt(2);	 // 外部函数表			

			::SetHxDataSource( (CHSDataSource*)ayData->GetAt(3),
				(CArray<ColorProperty*,ColorProperty*>*)ayData->GetAt(4) );
		}
	}
	else // error!!!????
	{
		m_pExternExpression = new CMapVariabile;     // 外部表达式表
		m_pExternVariabile  = new CMapVariabile;	 // 外部变量表
		m_pExternFunction   = new CMapVariabile;	 // 外部函数表	
		
	}

	InitSysFunction();

//	m_pExternExpression = DeleteVarsMap(m_pExternExpression,g_bIsExeFile);
//	m_pExternVariabile  = DeleteVarsMap(m_pExternVariabile,g_bIsExeFile);
//	m_pExternFunction   = DeleteVarsMap(m_pExternFunction,g_bIsExeFile);

}
Example #28
0
void SourceEdit::OnFormatRenumber()
{
  CArray<SourceLexer::Heading> headings;
  GetAllHeadings(headings);

  int indexes[SourceLexer::Section+1];
  for (int j = 0; j < sizeof(indexes) / sizeof(indexes[0]); j++)
    indexes[j] = 1;

  CallEdit(SCI_BEGINUNDOACTION);
  for (int i = 0; i < headings.GetSize(); i++)
  {
    const SourceLexer::Heading& heading = headings.GetAt(i);
    switch (heading.level)
    {
    case SourceLexer::Volume:
    case SourceLexer::Book:
    case SourceLexer::Part:
    case SourceLexer::Chapter:
    case SourceLexer::Section:
      {
        int pos = 0;
        CStringW sectionName = heading.name.Tokenize(L" ",pos);
        if (pos <= 0)
          break;
        CStringW sectionNumber = heading.name.Tokenize(L" ",pos);
        if (pos <= 0)
          break;

        CString replace;
        replace.Format("%S %d ",(LPCWSTR)sectionName,indexes[heading.level]);
        indexes[heading.level]++;
        for (int j = heading.level+1; j < sizeof(indexes) / sizeof(indexes[0]); j++)
          indexes[j] = 1;

        int linePos = CallEdit(SCI_POSITIONFROMLINE,heading.line);
        int lineEndPos = CallEdit(SCI_GETLINEENDPOSITION,heading.line);
        if (linePos+pos < lineEndPos)
          lineEndPos = linePos+pos;
        CallEdit(SCI_SETTARGETSTART,linePos);
        CallEdit(SCI_SETTARGETEND,lineEndPos);
        CallEdit(SCI_REPLACETARGET,replace.GetLength(),(LONG_PTR)(LPCSTR)replace);
      }
      break;
    }
  }
  CallEdit(SCI_ENDUNDOACTION);
}
 ~tScriptState()
 {
     int i;
     for (i = 0; i < Commands.GetCount(); ++i)
     {
         tCommand *pCmd = Commands.GetAt(i);
         delete pCmd;
     }
     POSITION pos = Labels.GetHeadPosition();
     while (pos)
     {
         tLabel *pLabel = Labels.GetAt(pos);
         delete pLabel;
         Labels.GetNext(pos);
     }
 }
Example #30
0
void CDlgCapture::OnTimer(UINT nIDEvent)
{
	if (1000 == nIDEvent)
	{
		KillTimer(nIDEvent);

		{
			CArray<CString, CString> arCapList;
			m_capImage.GetCapArray(arCapList);

		for(int i = 0; i < arCapList.GetCount(); i++)
		{
			// 2014-7-23 - qsc 由AddString改成InsertString
			m_comboDevices.InsertString(-1, arCapList.GetAt(i));
		}
		UINT nCameraIndex = CIBAConfig::GetInstance()->GetCameraIndex();
		if(nCameraIndex > m_comboDevices.GetCount())
		{
			nCameraIndex = 0;
			CIBAConfig::GetInstance()->SetCameraIndex(nCameraIndex);
		}
		m_comboDevices.SetCurSel (nCameraIndex);

		if (!m_capImage.Init(GetDlgItem(IDC_STATIC_VIDEO)->GetSafeHwnd(), -1))
		{
			// 2014-11-26 - qsc
			++nCameraIndex;
			CIBAConfig::GetInstance()->SetCameraIndex(nCameraIndex);
			if(nCameraIndex > m_comboDevices.GetCount())
			{
				nCameraIndex = 0;
				CIBAConfig::GetInstance()->SetCameraIndex(nCameraIndex);
			}

				IBA_LOG0(_T("摄像头初始化失败,没找到可用的摄像头"));
				EndDialog(IDCANCEL);
			}
		}

		OnBnClickedBtnChoosecamera();
		
		EnableControls();

		UpdateData(FALSE);
	}
}