Beispiel #1
0
void CLocalServer::SendBuffer(const NET_HEAD_MAN* pHead, const void* pBuf, BOOL bCheckStatus)
{
	if (bCheckStatus && m_CheckInStatus != 1)
	{
		return;
	}

	CByteArray buffer;
	buffer.SetSize(sizeof NET_HEAD_MAN + pHead->Length);

	memcpy(buffer.GetData(), pHead, sizeof NET_HEAD_MAN);

	if (pBuf != NULL)
	{
		memcpy(buffer.GetData() + sizeof NET_HEAD_MAN, pBuf, pHead->Length);
	}

	m_lpSocket->SendBuffer(buffer.GetData(), buffer.GetSize());
	buffer.RemoveAll();
}
Beispiel #2
0
BOOL COneCommand::GetReceivedBuffer(CByteArray &buffer) {
	BOOL ret;int i,size;BYTE src,dst;
	if((size=m_ReceiveBuffer.GetSize())!=buffer.GetSize()) {
		buffer.RemoveAll();
		buffer.Append(m_ReceiveBuffer);
		return TRUE;
		}
	else {
		ret=FALSE;
		for(i=0;i<size;i++) {
			src=m_ReceiveBuffer.GetAt(i);
			dst=buffer.GetAt(i);
			if(src!=dst) {
				buffer.SetAt(i,src);				
				ret=TRUE;
				}
			}
		return ret;
		}
	}
void CRichEditCtrlGS::GetRTF(CByteArray& arrText, const bool bAsRTF/*=true*/)
{ SCookieByteArray CookieRTF;
  arrText.RemoveAll();
  CookieRTF.lSize    = 0;
  CookieRTF.lStart   = 0;
  CookieRTF.pInText  = NULL;
  CookieRTF.pOutText = &arrText;
  
// Pull the text out
  EDITSTREAM es;
  es.dwError = 0;
  es.pfnCallback = StreamOutCByteArray;  // Set the callback
  es.dwCookie = (DWORD)&CookieRTF; // and the informations
  if( bAsRTF )	
    { StreamOut(SF_RTF,es);
	}
  else
    { StreamOut(SF_TEXT,es);
	}
}
Beispiel #4
0
void CTobCompiler::Reset()
{
    m_errornum = 0;
    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;
    CString str;

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

    p = m_valmap.GetStartPosition();
    SValueType* val;
    while(p)
    {
        m_valmap.GetNextAssoc(p, str, val);
        delete val;
    }
    m_valmap.RemoveAll();
    m_valmap.InitHashTable(251);

    for(int i = m_exparr.GetSize() - 1; i >= 0; --i)
        delete m_exparr.GetAt(i);
    m_exparr.RemoveAll();

    m_Option.DefInt = 4;
    m_Option.DefFloat = 4;
    m_Option.bIgnoreCase = FALSE;
}
Beispiel #5
0
void CLocalServer::LocalUnlockScreen(INT_PTR nIndex, CString strUnlockPwd)
{
	if (m_CheckInStatus != 1)
	{
		return;
	}

	if (ComputerList.IsInvaildIndex(nIndex))
	{
		return;
	}

	CComputerInfo& computer = ComputerList.GetComputer(nIndex);

	SCREEN_TERMINFO snapComputer = {0};
	_snprintf(snapComputer.termID, LEN_TERMID, CW2A(computer.GetTerminalID()));
	_snprintf(snapComputer.termIP, LEN_IPADDR, CW2A(computer.GetComputerIP()));

	NET_HEAD_MAN head = {0};

	head.Version = COM_VER;
	head.Length = sizeof SCREEN_TERMINFO + sizeof CHECK_PASSWORD;
	head.Cmd = C_MANGER_UNLOCKSCREEN;

	CHECK_PASSWORD pwd = {0};

	_snprintf(pwd.cPassword, LEN_CLIPASSWORD, CW2A(strUnlockPwd));
	
	CByteArray buffer;
	buffer.SetSize(sizeof NET_HEAD_MAN + head.Length);

	memcpy(buffer.GetData(), &head, sizeof NET_HEAD_MAN);
	memcpy(buffer.GetData() + sizeof NET_HEAD_MAN, &snapComputer, sizeof SCREEN_TERMINFO);
	memcpy(buffer.GetData() + sizeof NET_HEAD_MAN + sizeof SCREEN_TERMINFO, &pwd, sizeof CHECK_PASSWORD);

	m_lpSocket->SendBuffer(buffer.GetData(), buffer.GetSize());

	buffer.RemoveAll();
}
BOOL CBCGPRegistry::Read (LPCTSTR pszKey, CByteArray& bcArray)
{
	bcArray.RemoveAll();
	return Read (pszKey, (CObject&) bcArray);
}
BOOL CTyAnimate_Prop::OnInitDialog() 
{
	CPropertyPage::OnInitDialog();
	
	// TODO: Add extra initialization here
    m_listbmp.SetRectType(false);
    m_listbmp.SetColumnType(false);
    m_listvec.SetRectType(false);
    m_listvec.SetColumnType(false);

    CStringArray Head;
    CByteArray   Cols;
    Head.Add("序号");
	Cols.Add(20);
	Head.Add("图名");
	Cols.Add(60);
	Head.Add("透明色");
	Cols.Add(20);
	m_listbmp.InitCtrl(&Head, &Cols);

    Head.RemoveAll();
	Cols.RemoveAll();
	Head.Add("序号");
	Cols.Add(20);
	Head.Add("图名");
	Cols.Add(60);
	Head.Add("动态色");
	Cols.Add(20);
	m_listvec.InitCtrl(&Head, &Cols);

    m_listbmp.SendMessage(LVM_SETEXTENDEDLISTVIEWSTYLE, 0, (LPARAM)LVS_EX_FULLROWSELECT); 
    m_listvec.SendMessage(LVM_SETEXTENDEDLISTVIEWSTYLE, 0, (LPARAM)LVS_EX_FULLROWSELECT); 
	
	if (myanimate.picskind==0)
	{
		m_listbmp.ShowWindow(SW_SHOW);
		m_listvec.ShowWindow(SW_HIDE);
		for (int i=0;i<myanimate.piccount;i++)
		{
			CString tmp;
			tmp.Format("%d",i);
			Head.RemoveAll();
			Head.Add(tmp);
			Head.Add(myanimate.pics[i].picname);
			if (myanimate.pics[i].pickind==0) 
			{
				Head.Add("无");
			}else{
				Head.Add("有");
			}
		    int pos=m_listbmp.AddItem(&Head);
			m_listbmp.SetItemData(pos,myanimate.pics[i].piccolor);
		}
	//	m_listbmp.SetItemBackgndColor(WHITE,pos,0);
	//	m_listbmp.SetItemTextColor(BLACK,pos,0);
	}
	if (myanimate.picskind==1)
	{
		m_listbmp.ShowWindow(SW_HIDE);
		m_listvec.ShowWindow(SW_SHOW);
		for (int i=0;i<myanimate.piccount;i++)
		{
			CString tmp;
			tmp.Format("%d",i);
			Head.RemoveAll();
			Head.Add(tmp);
			Head.Add(myanimate.pics[i].picname);
			if (myanimate.pics[i].pickind==0) 
			{
				Head.Add("无");
			}else{
				Head.Add("有");
			}
		    int pos=m_listvec.AddItem(&Head);
			m_listvec.SetItemData(pos,myanimate.pics[i].piccolor);
		}
	//	m_listbmp.SetItemBackgndColor(WHITE,pos,0);
	//	m_listbmp.SetItemTextColor(BLACK,pos,0);
	}

	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
/*static*/
HRESULT CSheetConfigGSD::GetExtUserParams(IExtUserParam* pParam, ExtParam* pExtParam)
{
	if (pParam == NULL || pExtParam == NULL)
		return E_POINTER;

	BSTR    sName;
	USES_CONVERSION;
    HRESULT hr = pParam->get_Description(&sName);
    if (SUCCEEDED(hr)) {
		pExtParam->SetDescription(sName);
		::SysFreeString(sName);
    }
	else	{
		delete pExtParam;
		return hr;
	}

    long lTmp = 0;
    long lOffset = 0;
    hr = pParam->get_Offset(&lOffset);
    if (SUCCEEDED(hr)) {
		pExtParam->SetByteOffset(lOffset);
    }
	else	{
		delete pExtParam;
		return hr;
	}
    BOOL bConst = FALSE;
    BOOL bVarEnum = FALSE;
    BOOL bVarRange = FALSE;
    BOOL bBitArea = FALSE;
    hr = pParam->get_IsConstantParam(&bConst);
    if (SUCCEEDED(hr)) {
		pExtParam->SetIfConstant(bConst);
	}
	else	{
		delete pExtParam;
		return hr;
	}

    if (bConst)
    {
        CComVariant vtBytes;
        hr = pParam->get_ConstPrmBytes(&vtBytes);
        if (SUCCEEDED(hr)) {
			HRESULT     hr;
			// is it what we expected in VARIANT?
            ASSERT(vtBytes.vt == (VT_UI1 | VT_ARRAY));
			if (vtBytes.vt == (VT_UI1 | VT_ARRAY))
			{
				// now show values
				SAFEARRAY   *psaBytes = vtBytes.parray;

				long    lBound = 0, uBound = 0;
				hr = ::SafeArrayGetLBound(psaBytes, 1, &lBound);
				_ASSERTE(SUCCEEDED(hr));
				hr = ::SafeArrayGetUBound(psaBytes, 1, &uBound);
				_ASSERTE(SUCCEEDED(hr));
				// loop thru all objects in this level:
				CByteArray octets;
				octets.RemoveAll();
				for (long i = lBound; i <= uBound; i++)
				{
					BYTE    ucVal;
					hr = ::SafeArrayGetElement(psaBytes, &i, &ucVal);
					_ASSERTE(SUCCEEDED(hr));
					if (FAILED(hr)) {
						continue;
					}
					octets.Add(ucVal);
				}// next byte
				pExtParam->SetConstantBytes(octets.GetData(), octets.GetSize());
			}
		}
        pExtParam->SetParamType(Array);
        return S_OK;
    }

    hr = pParam->get_DefaultValue(&lTmp);
    if (SUCCEEDED(hr)) {
		pExtParam->SetDefaultValue(lTmp);
    }
    hr = pParam->get_IsVariableEnumParam(&bVarEnum);
    if (SUCCEEDED(hr)) {
		//pExtParam->SetIfVariableEnum(bVarEnum);
    }
	else	{
		delete pExtParam;
		return hr;
	}
    hr = pParam->get_IsVariableMinMaxParam(&bVarRange);
    if (SUCCEEDED(hr)) {
        hr = pParam->get_MinValue(&lTmp);
        if (SUCCEEDED(hr)) {
			pExtParam->SetLowerValue(lTmp);
        }
        hr = pParam->get_MaxValue(&lTmp);
        if (SUCCEEDED(hr)) {
			pExtParam->SetUpperValue(lTmp);
        }
    }
	else	{
		delete pExtParam;
		return hr;
	}
    hr = pParam->get_IsBitArea(&bBitArea);
    if (SUCCEEDED(hr)) {
		pExtParam->SetIfBitArea(bBitArea);
        // show bit area params
        hr = pParam->get_BitAreaStart(&lTmp);
        if (SUCCEEDED(hr)) {
			pExtParam->SetBitAreaStart(lTmp);
		}
        hr = pParam->get_BitAreaLength(&lTmp);
        if (SUCCEEDED(hr)) {
			pExtParam->SetBitAreaLength(lTmp);
        }
    }
	else	{
		delete pExtParam;
		return hr;
	}

	CComVariant vtValues, vtNames;
	hr = pParam->NamedEnumValues(&vtValues, &vtNames);
	if (SUCCEEDED(hr)) {
		HRESULT hr;
		// is it what we expected in VARIANT?
        ASSERT(vtValues.vt == (VT_I4 | VT_ARRAY));
        ASSERT(vtNames.vt == (VT_BSTR | VT_ARRAY));
		if (   (vtValues.vt == (VT_I4 | VT_ARRAY))
			&& (vtNames.vt == (VT_BSTR | VT_ARRAY))  )
		{
			// now show values and texts
			SAFEARRAY   *psaValues = vtValues.parray;
			SAFEARRAY   *psaNames = vtNames.parray;

			long    lBound = 0, uBound = 0;
			hr = ::SafeArrayGetLBound(psaValues, 1, &lBound);
			_ASSERTE(SUCCEEDED(hr));
			hr = ::SafeArrayGetUBound(psaValues, 1, &uBound);
			_ASSERTE(SUCCEEDED(hr));
			// loop thru all objects in this level:
			for (long i = lBound; i <= uBound; i++)
			{
				LONG    lVal;
				BSTR    sName;
				hr = ::SafeArrayGetElement(psaValues, &i, &lVal);
				_ASSERTE(SUCCEEDED(hr));
				hr = ::SafeArrayGetElement(psaNames, &i, &sName);
				_ASSERTE(SUCCEEDED(hr));
				if (FAILED(hr)) {
					continue;
				}
				NamedEnumValues* pElement = new NamedEnumValues;
				pElement->Value = lVal;
				pElement->szName = sName;
				pExtParam->AddNamedEnumVal(pElement);
                SysFreeString(sName);
			}// next
		}
	}// end if (SUCCEEDED(hr))

    if (bVarEnum && !pExtParam->IsVariableEnumParam())
    {
        CComVariant vtEnums;
        hr = pParam->EnumValues(&vtEnums);
        if (SUCCEEDED(hr)) {
            ASSERT(vtEnums.vt == (VT_I4 | VT_ARRAY));
			if (vtEnums.vt == (VT_I4 | VT_ARRAY))	{
				// now show values and texts
				SAFEARRAY   *psaValues = vtEnums.parray;

				long    lBound = 0, uBound = 0;
				hr = ::SafeArrayGetLBound(psaValues, 1, &lBound);
				_ASSERTE(SUCCEEDED(hr));
				hr = ::SafeArrayGetUBound(psaValues, 1, &uBound);
				_ASSERTE(SUCCEEDED(hr));
				// loop thru all objects in this level:
				for (long i = lBound; i <= uBound; i++)
				{
					LONG    lVal;
					CString szName;
					hr = ::SafeArrayGetElement(psaValues, &i, &lVal);
					_ASSERTE(SUCCEEDED(hr));
					if (FAILED(hr)) {
						continue;
					}
					szName.Format(_T("%d"), lVal);

					NamedEnumValues* pElement = new NamedEnumValues;
					pElement->Value = lVal;
					pElement->szName = szName;
					pExtParam->AddNamedEnumVal(pElement);
				} //next i
			}// end if
        }// end if
    }// end if

    SetExtParamType(pParam,pExtParam);
    return S_OK;
}
void 座位详情页::OnBnClickedButton1()
{	
	UpdateData(TRUE);
	if (flag == 1)
	{
		//flag++;
		if (x = 1)
			strcpy(fileDizhi, "res\\mv1.ini");
		if (x==2)
			strcpy(fileDizhi, "res\\mv2.ini");
		if (x==3)
			strcpy(fileDizhi, "res\\mv3.ini");
	}
	load();
	if (flag == 1)
	{
		//flag++;
		if (x = 1)
			strcpy(fileDizhi, "res\\mv1.ini");
		if (x == 2)
			strcpy(fileDizhi, "res\\mv2.ini");
		if (x == 3)
			strcpy(fileDizhi, "res\\mv3.ini");
	}
	int k,yu=0;
	for (k = 0; k < 16; k++)
	{
		if (str[diDian][changCi][k] == 'k')
		{
			yu++;
			CStatic *pic=NULL;
			switch (k)
			{
			case 0: pic = (CStatic *)GetDlgItem(IDC_STATIC1); break;
			case 1: pic = (CStatic *)GetDlgItem(IDC_STATIC2); break;
			case 2: pic = (CStatic *)GetDlgItem(IDC_STATIC3); break;
			case 3: pic = (CStatic *)GetDlgItem(IDC_STATIC4); break;
			case 4: pic = (CStatic *)GetDlgItem(IDC_STATIC5); break;
			case 5: pic = (CStatic *)GetDlgItem(IDC_STATIC6); break;
			case 6: pic = (CStatic *)GetDlgItem(IDC_STATIC7); break;
			case 7: pic = (CStatic *)GetDlgItem(IDC_STATIC8); break;
			case 8: pic = (CStatic *)GetDlgItem(IDC_STATIC9); break;
			case 9: pic = (CStatic *)GetDlgItem(IDC_STATIC10); break;
			case 10: pic = (CStatic *)GetDlgItem(IDC_STATIC11); break;
			case 11: pic = (CStatic *)GetDlgItem(IDC_STATIC12); break;
			case 12: pic = (CStatic *)GetDlgItem(IDC_STATIC13); break;
			case 13: pic = (CStatic *)GetDlgItem(IDC_STATIC14); break;
			case 14: pic = (CStatic *)GetDlgItem(IDC_STATIC15); break;
			case 15: pic = (CStatic *)GetDlgItem(IDC_STATIC16); break;
			default:MessageBox(_T("k值错误"));
			}
			pic->ShowWindow(SW_SHOW);

		}
		else
		{
			CStatic *pic=NULL;
			switch (k)
			{
			case 0: pic = (CStatic *)GetDlgItem(IDC_STATIC1); break;
			case 1: pic = (CStatic *)GetDlgItem(IDC_STATIC2); break;
			case 2: pic = (CStatic *)GetDlgItem(IDC_STATIC3); break;
			case 3: pic = (CStatic *)GetDlgItem(IDC_STATIC4); break;
			case 4: pic = (CStatic *)GetDlgItem(IDC_STATIC5); break;
			case 5: pic = (CStatic *)GetDlgItem(IDC_STATIC6); break;
			case 6: pic = (CStatic *)GetDlgItem(IDC_STATIC7); break;
			case 7: pic = (CStatic *)GetDlgItem(IDC_STATIC8); break;
			case 8: pic = (CStatic *)GetDlgItem(IDC_STATIC9); break;
			case 9: pic = (CStatic *)GetDlgItem(IDC_STATIC10); break;
			case 10: pic = (CStatic *)GetDlgItem(IDC_STATIC11); break;
			case 11: pic = (CStatic *)GetDlgItem(IDC_STATIC12); break;
			case 12: pic = (CStatic *)GetDlgItem(IDC_STATIC13); break;
			case 13: pic = (CStatic *)GetDlgItem(IDC_STATIC14); break;
			case 14: pic = (CStatic *)GetDlgItem(IDC_STATIC15); break;
			case 15: pic = (CStatic *)GetDlgItem(IDC_STATIC16); break;
			default:MessageBox(_T("k值错误"));
			}
			pic->ShowWindow(SW_HIDE);
		}	
	}
	CByteArray array;    //动态数组
	array.RemoveAll();   //清除动态数组
	array.Add(yu);	 //按字节添加数据
	comKou.put_Output(COleVariant(array));  //发送数据
	save();
	load();
	UpdateData(FALSE);
}