當前位置: 首頁>>代碼示例>>C++>>正文


C++ CountArray函數代碼示例

本文整理匯總了C++中CountArray函數的典型用法代碼示例。如果您正苦於以下問題:C++ CountArray函數的具體用法?C++ CountArray怎麽用?C++ CountArray使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了CountArray函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: _snprintf

//初始化函數
BOOL CShortMessage::OnInitDialog()
{
	CSkinDialogEx::OnInitDialog();

	m_cbButtonState[BST_MAX]=BUT_EXIST|BUT_DISABLE;
	m_cbButtonState[BST_MIN]=BUT_EXIST|BUT_NORMAL;

	//設置標題
	if (m_pTargetUserItem!=NULL)
	{
		TCHAR szTitle[256];
		_snprintf(szTitle,sizeof(szTitle),TEXT("[ %s ] - [ %s ]"),m_pTargetUserItem->GetUserData()->szName,m_strRoomName);
		SetWindowText(szTitle);
	}

	//信息代理
	if (m_MessageProxyHelper.CreateInstance()==false) return false;
	if (m_MessageProxyHelper->SetRichEditHwnd(&m_RecvMessage)==false) return false;

	//按鈕皮膚
	m_BtExpression.SetButtonImage(g_GlobalUnits.m_WhisperViewImage.uBtExpression,g_GlobalUnits.m_PlatformResourceModule->GetResInstance(),false);

	//設置控件
	m_RecvMessage.SetBackgroundColor(FALSE,RGB(230,249,255));
	m_SendMessage.LimitText(MAX_CHAT_LEN);
	m_SendMessage.SetFocus();

	//消息頭
	TCHAR szTitle[128]=TEXT("");
	_snprintf(szTitle,CountArray(szTitle),TEXT("【溫馨提示】"));
	m_MessageProxyHelper->InsertGeneralString(szTitle,RGB(255,0,0),MS_NORMAL,false);

	//預警信息
	TCHAR szMessage[128] ;
	_snprintf(szMessage,CountArray(szMessage),TEXT("客服人員不會以任何形式向您索取您的帳戶信息,請玩家提高警惕,保護好自己帳號密碼!"));
	m_MessageProxyHelper->InsertShtickString(szMessage,RGB(0,0,0),MS_NORMAL,true);

	return FALSE;
}
開發者ID:Michael-Z,項目名稱:qipai-game,代碼行數:40,代碼來源:ShortMessage.cpp

示例2:

//或等於
CChiHuRight & CChiHuRight::operator |= ( DWORD dwRight )
{
	//驗證權位
	if( !IsValidRight( dwRight ) ) return *this;

	for( BYTE i = 0; i < CountArray(m_dwRightMask); i++ )
	{
		if( (dwRight&m_dwRightMask[i]) || (i==0&&dwRight<0x10000000) )
			m_dwRight[i] |= (dwRight&MASK_CHI_HU_RIGHT);
	}

	return *this;
}
開發者ID:vsanth,項目名稱:kkj,代碼行數:14,代碼來源:GameLogic.cpp

示例3: DeductionTableCard

//扣除撲克
void CGameClientDlg::DeductionTableCard(bool bHeadCard)
{
	if (bHeadCard==true)
	{
		//切換索引
		BYTE cbHeapCount=m_cbHeapCardInfo[m_wHeapHand][0]+m_cbHeapCardInfo[m_wHeapHand][1];
		if (cbHeapCount==HEAP_FULL_COUNT)
			m_wHeapHand=(m_wHeapHand+1)%CountArray(m_cbHeapCardInfo);

		//減少撲克
		m_cbLeftCardCount--;
		m_cbHeapCardInfo[m_wHeapHand][0]++;

		//堆立撲克
		WORD wHeapViewID=SwitchViewChairID(m_wHeapHand);
		WORD wMinusHeadCount=m_cbHeapCardInfo[m_wHeapHand][0];
		WORD wMinusLastCount=m_cbHeapCardInfo[m_wHeapHand][1];
		m_GameClientView.m_HeapCard[wHeapViewID].SetCardData(wMinusHeadCount,wMinusLastCount,HEAP_FULL_COUNT);
	}
	else
	{
		//切換索引
		BYTE cbHeapCount=m_cbHeapCardInfo[m_wHeapTail][0]+m_cbHeapCardInfo[m_wHeapTail][1];
		if (cbHeapCount==HEAP_FULL_COUNT)
			m_wHeapTail=(m_wHeapTail+3)%CountArray(m_cbHeapCardInfo);

		//減少撲克
		m_cbLeftCardCount--;
		m_cbHeapCardInfo[m_wHeapTail][1]++;

		//堆立撲克
		WORD wHeapViewID=SwitchViewChairID(m_wHeapTail);
		WORD wMinusHeadCount=m_cbHeapCardInfo[m_wHeapTail][0];
		WORD wMinusLastCount=m_cbHeapCardInfo[m_wHeapTail][1];
		m_GameClientView.m_HeapCard[wHeapViewID].SetCardData(wMinusHeadCount,wMinusLastCount,HEAP_FULL_COUNT);
	}

	return;
}
開發者ID:codercold,項目名稱:whgame,代碼行數:40,代碼來源:GameClientDlg.cpp

示例4: memset

//發送坐下失敗
void CTableFrame::SendSitFailedPacket(IServerUserItem * pIServerUserItem, LPCTSTR pszFailedDescribe)
{
	//構造數據
	CMD_GR_SitFailed SitFailed;
	memset(&SitFailed,0,sizeof(SitFailed));
	lstrcpyn(SitFailed.szFailedDescribe,pszFailedDescribe,CountArray(SitFailed.szFailedDescribe));

	//發送數據
	WORD wSendSize=sizeof(SitFailed)-sizeof(SitFailed.szFailedDescribe)+CountString(SitFailed.szFailedDescribe);
	m_pIGameServiceFrame->SendData(pIServerUserItem,MDM_GR_USER,SUB_GR_SIT_FAILED,&SitFailed,wSendSize);

	return;
}
開發者ID:275958081,項目名稱:netfox,代碼行數:14,代碼來源:TableFrame.cpp

示例5: lstrcpyn

//設置密碼
VOID CPasswordControl::SetUserPassword(LPCTSTR pszPassword)
{
	//設置控件
	INT nPasswordLen=lstrlen(pszPassword);
	m_edPassword.SetWindowText((nPasswordLen>0)?TEXT("********"):TEXT(""));

	//設置變量
	m_bModify=false;
	m_bFalsity=true;
	lstrcpyn(m_szPassword,pszPassword,CountArray(m_szPassword));

	return;
}
開發者ID:lonyzone,項目名稱:oathx-ogrex-editor,代碼行數:14,代碼來源:PasswordControl.cpp

示例6: GetLocalTime

//收到消息
void CShortMessage::OnRecvMessage(TCHAR * szSendName, TCHAR * szMessage, COLORREF crColor, bool bMeMessage)
{
	//獲取時間
	SYSTEMTIME SystemTime;
	GetLocalTime(&SystemTime);

	//消息頭
	TCHAR szTitle[128]=TEXT("");
	_snprintf(szTitle,CountArray(szTitle),TEXT("%s %02d:%02d:%02d\n   "),szSendName,SystemTime.wHour,SystemTime.wMinute,SystemTime.wSecond);
	m_MessageProxyHelper->InsertGeneralString(szTitle,(bMeMessage==true)?RGB(0,128,64):RGB(0,0,255),MS_NORMAL,false);

	//插入消息
	m_MessageProxyHelper->InsertShtickString(szMessage,crColor,MS_NORMAL,true);
	m_MessageProxyHelper->InsertGeneralString(TEXT(""),crColor,MS_NORMAL,true);

	//寫入文件
	try
	{
		TCHAR szTitle[128]=TEXT("");
		_snprintf(szTitle,CountArray(szTitle),TEXT("[%s] %u/%u/%u %02d:%02d:%02d"),szSendName,SystemTime.wYear, SystemTime.wMonth, SystemTime.wDay,SystemTime.wHour,SystemTime.wMinute,SystemTime.wSecond);

		//寫入文件
		CFile MsgFile;
		if(MsgFile.Open(m_strMsgFileName, CFile::modeWrite|CFile::modeNoTruncate|CFile::modeCreate))
		{
			MsgFile.SeekToEnd() ;
			MsgFile.Write(szTitle, UINT(strlen(szTitle))) ;
			MsgFile.Write("\r\n", UINT(strlen("\r\n"))) ;
		
			MsgFile.Write(szMessage, UINT(strlen(szMessage))) ;
			MsgFile.Write("\r\n\r\n", UINT(strlen("\r\n\r\n"))) ;
			MsgFile.Close() ;
		}

	}
	catch(...){}

	return;
}
開發者ID:Michael-Z,項目名稱:qipai-game,代碼行數:40,代碼來源:ShortMessage.cpp

示例7: ASSERT

//更新關係
const tagCompanionItem * __cdecl CCompanionManager::UpdateCompanionItem(DWORD dwUserID, LPCTSTR pszAccounts, LPCTSTR pszFace)
{
	tagCompanionItem * pCompanionItem=NULL;
	for (INT_PTR i=0;i<m_CompanionItemActive.GetCount();i++)
	{
		pCompanionItem=m_CompanionItemActive[i];
		ASSERT(pCompanionItem!=NULL);
		if (pCompanionItem->dwUserID==dwUserID)
		{
			//設置數據
			m_bNeedUpdate=true;
			lstrcpyn(pCompanionItem->szFace,pszFace,CountArray(pCompanionItem->szFace));
			lstrcpyn(pCompanionItem->szAccounts,pszAccounts,CountArray(pCompanionItem->szAccounts));

			//更新界麵
			m_DlgCompanionManager.UpdateCompanionItem(pCompanionItem,false);

			return pCompanionItem;
		}
	}
	return NULL;
}
開發者ID:duzhi5368,項目名稱:FKChessCards,代碼行數:23,代碼來源:CompanionManager.cpp

示例8: ZeroMemory

//取消申請
bool CTableFrameSink::OnUserCancelBanker(IServerUserItem *pICancelServerUserItem)
{
	//當前莊家
	if (pICancelServerUserItem->GetChairID()==m_wCurrentBanker && m_pITableFrame->GetGameStatus()!=GS_FREE)
	{
		//發送消息
		m_pITableFrame->SendGameMessage(pICancelServerUserItem,TEXT("遊戲已經開始,不可以取消當莊!"),SMT_INFO|SMT_EJECT);
		return true;
	}

	//存在判斷
	for (WORD i=0; i<m_ApplyUserArray.GetCount(); ++i)
	{
		//獲取玩家
		WORD wChairID=m_ApplyUserArray[i];
		IServerUserItem *pIServerUserItem=m_pITableFrame->GetServerUserItem(wChairID);

		//條件過濾
		if (pIServerUserItem==NULL) 
			continue;
		if (pIServerUserItem->GetUserID()!=pICancelServerUserItem->GetUserID()) 
			continue;

		//刪除玩家
		m_ApplyUserArray.RemoveAt(i);

		if (m_wCurrentBanker!=wChairID)
		{
			//構造變量
			CMD_S_CancelBanker CancelBanker;
			ZeroMemory(&CancelBanker,sizeof(CancelBanker));

			//設置變量
			lstrcpyn(CancelBanker.szCancelUser,pIServerUserItem->GetAccounts(),CountArray(CancelBanker.szCancelUser));

			//發送消息
			m_pITableFrame->SendTableData(INVALID_CHAIR, SUB_S_CANCEL_BANKER, &CancelBanker, sizeof(CancelBanker));
			m_pITableFrame->SendLookonData(INVALID_CHAIR, SUB_S_CANCEL_BANKER, &CancelBanker, sizeof(CancelBanker));
		}
		else if (m_wCurrentBanker==wChairID)
		{
			//切換莊家 
			m_wCurrentBanker=INVALID_CHAIR;
			ChangeBanker(true);
		}

		return true;
	}

	return false;
}
開發者ID:Michael-Z,項目名稱:qipai-game,代碼行數:52,代碼來源:TableFrameSink.cpp

示例9: Information

//連接事件
bool CEditUnderWrite::OnEventMissionLink(INT nErrorCode)
{
	//錯誤判斷
	if (nErrorCode!=0L)
	{
		//錯誤提示
		CInformation Information(m_pParentWnd);
		Information.ShowMessageBox(TEXT("服務器連接失敗,個性簽名更新失敗!"),MB_ICONERROR,30L);

		return true;
	}

	//設置變量
	m_bNeedSend=false;

	//變量定義
	ASSERT(GetMissionManager()!=NULL);
	CMissionManager * pMissionManager=GetMissionManager();

	//用戶信息
	CGlobalUserInfo * pGlobalUserInfo=CGlobalUserInfo::GetInstance();
	tagGlobalUserData * pGlobalUserData=pGlobalUserInfo->GetGlobalUserData();

	//變量定義
	CMD_GP_ModifyUnderWrite ModifyUnderWrite;
	ZeroMemory(&ModifyUnderWrite,sizeof(ModifyUnderWrite));

	//設置數據
	ModifyUnderWrite.dwUserID=pGlobalUserData->dwUserID;
	lstrcpyn(ModifyUnderWrite.szUnderWrite,m_szUnderWrite,CountArray(ModifyUnderWrite.szUnderWrite));
	lstrcpyn(ModifyUnderWrite.szPassword,pGlobalUserData->szPassword,CountArray(ModifyUnderWrite.szPassword));

	//發送數據
	WORD wHeadSize=sizeof(ModifyUnderWrite)-sizeof(ModifyUnderWrite.szUnderWrite);
	pMissionManager->SendData(MDM_GP_USER_SERVICE,SUB_GP_MODIFY_UNDER_WRITE,&ModifyUnderWrite,wHeadSize+CountStringBuffer(ModifyUnderWrite.szUnderWrite));

	return true;
}
開發者ID:Michael-Z,項目名稱:qipai-game,代碼行數:39,代碼來源:WndUserInfoCtrl.cpp

示例10: GetDlgItemText

//保存輸入
bool CDlgRegWizardAccount::SaveInputInfo()
{
	//變量定義
	CString strAccount;
	TCHAR szPassword[LEN_PASSWORD]=TEXT("");

	//保存輸入
	GetDlgItemText(IDC_ACCOUNTS,strAccount);
	GetDlgItemText(IDC_PASSWORD,m_szPassword,CountArray(m_szPassword));
	GetDlgItemText(IDC_PASSWORD2,szPassword,CountArray(szPassword));

	//效驗用戶名
	strAccount.TrimLeft();
	strAccount.TrimRight();
	if (strAccount.IsEmpty())
	{
		ShowInformation(TEXT("用戶帳號不能為空,請重新輸入!"),MB_ICONERROR);
		m_edAccounts.SetFocus();
		return false;
	}
	lstrcpyn(m_szAccounts,strAccount,sizeof(m_szAccounts));

	//效驗密碼
	if (m_szPassword[0]==0)
	{
		ShowInformation(TEXT("登錄密碼不能為空,請重新輸入!"),MB_ICONERROR);
		m_edPassword.SetFocus();
		return false;
	}
	if (lstrcmp(m_szPassword,szPassword)!=0)
	{
		ShowInformation(TEXT("兩次輸入的登錄密碼不相同,請重新輸入!"),MB_ICONERROR);
		m_edPassword2.SetFocus();
		return false;
	}

	return true;
}
開發者ID:cyrillic7,項目名稱:CPFrom,代碼行數:39,代碼來源:DlgRegister+.cpp

示例11: SwitchCardPoint

//索引切換
WORD CCardControl::SwitchCardPoint(CPoint & MousePoint)
{
	//基準位置
	int nXPos=MousePoint.x-m_ControlPoint.x;
	int nYPos=MousePoint.y-m_ControlPoint.y;

	//範圍判斷
	if ((nXPos<0)||(nXPos>m_ControlSize.cx)) return INVALID_ITEM;
	if ((nYPos<POS_SHOOT)||(nYPos>m_ControlSize.cy)) return INVALID_ITEM;

	//牌列子項
	if (nXPos<CARD_WIDTH*CountArray(m_CardItemArray))
	{
		WORD wViewIndex=(WORD)(nXPos/CARD_WIDTH)+m_wCardCount;
		if (wViewIndex>=CountArray(m_CardItemArray)) return wViewIndex-CountArray(m_CardItemArray);
		return INVALID_ITEM;
	}

	//當前子項
	if ((m_CurrentCard.cbCardData!=0)&&(nXPos>=(m_ControlSize.cx-CARD_WIDTH))) return CountArray(m_CardItemArray);

	return INVALID_ITEM;
}
開發者ID:275958081,項目名稱:netfox,代碼行數:24,代碼來源:CardControl.cpp

示例12: _sntprintf

//地區信息
VOID CDlgRegWizardUserInfo::LoadAreaInfo(LPCTSTR pszCity)
{
	//工作目錄
	TCHAR szDirectory[MAX_PATH]=TEXT("");
	CWHService::GetWorkDirectory(szDirectory,CountArray(szDirectory));

	//變量定義
	TCHAR szAreaFile[MAX_PATH],szItem[20],szAreaRead[CountArray(m_szArea)];
	_sntprintf(szAreaFile,CountArray(szAreaFile),TEXT("%s\\AreaInfo.INI"),szDirectory);

	//讀取資料
	m_comArea.ResetContent();
	UINT nCount=GetPrivateProfileInt(pszCity,TEXT("COUNT"),0,szAreaFile);
	for (UINT i=0;i<nCount;i++)
	{
		szAreaRead[0]=0;
		_sntprintf(szItem,CountArray(szItem),TEXT("Item%d"),i);
		GetPrivateProfileString(pszCity,szItem,TEXT(""),szAreaRead,sizeof(szAreaRead),szAreaFile);
		if ((szAreaRead[0]!=0)&&(m_comArea.FindString(0,szAreaRead)==LB_ERR)) m_comArea.AddString(szAreaRead);
	}

	return;
}
開發者ID:cyrillic7,項目名稱:CPFrom,代碼行數:24,代碼來源:DlgRegister+.cpp

示例13: SaveInputInfo

//保存輸入
bool CDlgRegWizardUserInfo::SaveInputInfo()
{
	//用戶年齡
	INT nCurSel=m_comAge.GetCurSel();
	if (nCurSel==LB_ERR)
	{
		TCHAR szBuffer[16];
		m_comAge.GetWindowText(szBuffer,CountArray(szBuffer));
		m_cbAge=(BYTE)_tstoi(szBuffer);
	}
	else m_cbAge=(BYTE)m_comAge.GetItemData(nCurSel);

	//用戶性別
	nCurSel=m_comGender.GetCurSel();
	m_cbGender=(nCurSel!=LB_ERR)?(BYTE)m_comGender.GetItemData(nCurSel):GENDER_UNKNOW;

	//區域信息
	m_comArea.GetWindowText(m_szArea,CountArray(m_szArea));
	m_comCity.GetWindowText(m_szCity,CountArray(m_szCity));
	m_comProvince.GetWindowText(m_szProvince,CountArray(m_szProvince));
	
	return true;
}
開發者ID:cyrillic7,項目名稱:CPFrom,代碼行數:24,代碼來源:DlgRegister+.cpp

示例14: _sntprintf

//獲取連接
bool CGameServerDlg::InitDataBaseParameter(tagDataBaseParameter & DataBaseParameter)
{
	//獲取路徑
	TCHAR szWorkDir[MAX_PATH]=TEXT("");
	CWHService::GetWorkDirectory(szWorkDir,CountArray(szWorkDir));

	//構造路徑
	TCHAR szIniFile[MAX_PATH]=TEXT("");
	_sntprintf(szIniFile,CountArray(szIniFile),TEXT("%s\\ServerParameter.ini"),szWorkDir);

	//讀取配置
	CWHIniData IniData;
	IniData.SetIniFilePath(szIniFile);

	//連接信息
	DataBaseParameter.wDataBasePort=(WORD)IniData.ReadInt(TEXT("PlatformDB"),TEXT("DBPort"),1433);
	IniData.ReadEncryptString(TEXT("PlatformDB"),TEXT("DBAddr"),NULL,DataBaseParameter.szDataBaseAddr,CountArray(DataBaseParameter.szDataBaseAddr));
	IniData.ReadEncryptString(TEXT("PlatformDB"),TEXT("DBUser"),NULL,DataBaseParameter.szDataBaseUser,CountArray(DataBaseParameter.szDataBaseUser));
	IniData.ReadEncryptString(TEXT("PlatformDB"),TEXT("DBPass"),NULL,DataBaseParameter.szDataBasePass,CountArray(DataBaseParameter.szDataBasePass));
	IniData.ReadEncryptString(TEXT("PlatformDB"),TEXT("DBName"),szPlatformDB,DataBaseParameter.szDataBaseName,CountArray(DataBaseParameter.szDataBaseName));

	return true;
}
開發者ID:lonyzone,項目名稱:whplaza,代碼行數:24,代碼來源:GameServerDlg.cpp

示例15: lstrcpyn

//發送遊戲消息
bool __cdecl CTableFrame::SendGameMessage(IServerUserItem * pIServerUserItem, LPCTSTR lpszMessage, WORD wMessageType)
{
	//構造數據包
	CMD_GF_Message Message;
	Message.wMessageType=wMessageType;
	lstrcpyn(Message.szContent,lpszMessage,CountArray(Message.szContent));
	Message.wMessageLength=CountString(Message.szContent);

	//發送數據
	WORD wSendSize=sizeof(Message)-sizeof(Message.szContent)+Message.wMessageLength*sizeof(TCHAR);
	m_pIGameServiceFrame->SendData(pIServerUserItem,MDM_GF_FRAME,SUB_GF_MESSAGE,&Message,wSendSize);

	return true;
}
開發者ID:275958081,項目名稱:netfox,代碼行數:15,代碼來源:TableFrame.cpp


注:本文中的CountArray函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。