本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}