ICQ_EXPORT TcpSessionListener *createSession(TcpSessionBase *tcp) { AFX_MANAGE_STATE(AfxGetStaticModuleState()); ChatSession *session = new ChatSession(tcp); CChatDlg *dlg = new CChatDlg(session); dlg->Create(IDD_CHAT); session->setListener(dlg); return session; }
BOOL CGameManageDlg::OnCommand(WPARAM wParam, LPARAM lParam) { // TODO: 在此添加专用代码和/或调用基类 switch (LOWORD(wParam)) { case MSG_CMD_GM_ACT_NO_TALK: case MSG_CMD_GM_ACT_KICK_OUT: // case MSG_CMD_GM_ACT_KICK_OUT: case MSG_CMD_GM_ACT_BANDON_ID: { m_OperateDlg.SetUserInfo(&(m_wSocket.m_UserManage.FindOnLineUserByIndex(m_ListIndex2)->GameUserInfo), m_pCurrentRoom->m_RoomInfo->uRoomID); m_OperateDlg.SetOperateType(LOWORD(wParam) - MSG_CMD_GM_ACT_AWORD + 1); m_OperateDlg.DoModal(); break; } case MSG_CMD_GM_ACT_AWORD: { m_AWardDlg.SetUserInfo(&(m_wSocket.m_UserManage.FindOnLineUserByIndex(m_ListIndex2)->GameUserInfo), m_pCurrentRoom->m_RoomInfo->uRoomID); m_AWardDlg.SetAwardList(*m_PropList); m_AWardDlg.SetAwardProjectList(*m_AwardType); m_AWardDlg.DoModal(); break; } case MSG_CMD_CM_START_CHAT: { bool flag = false; for (vector<CChatDlg*>::iterator i = m_ChatDlgs.begin(); i != m_ChatDlgs.end();) { if ((*i)->m_iUserID != -1 && (*i)->m_iUserID == m_wSocket.m_UserManage.FindOnLineUserByIndex(m_ListIndex2)->GameUserInfo.dwUserID) { flag = true; (*i)->ShowWindow(SW_SHOW); } if ((*i)->m_iUserID == -1) { (*i)->DestroyWindow(); delete (*i); i = m_ChatDlgs.erase(i); } else i++; } if (!flag) { CChatDlg* ChatDlg = new CChatDlg; ChatDlg->SetUserInfo(&(m_wSocket.m_UserManage.FindOnLineUserByIndex(m_ListIndex2)->GameUserInfo), m_pCurrentRoom->m_RoomInfo->uRoomID); ChatDlg->Create(IDD_DIALOG6, this); ChatDlg->ShowWindow(SW_SHOW); m_ChatDlgs.push_back(ChatDlg); } break; } case MSG_CMD_GM_LOCK: { m_wSocket.LockDesk(m_pLogonInfo->dwUserID, m_ListIndex1, 1); break; } case MSG_CMD_GM_UNLOCK: { m_wSocket.LockDesk(m_pLogonInfo->dwUserID, m_ListIndex1, 2); break; } case MSG_CMD_GM_ALLLOCK: { m_LockDeskDlg.SetInfo(1, 1, m_pCurrentRoom->m_RoomInfo->uDeskCount); m_LockDeskDlg.DoModal(); break; } case MSG_CMD_GM_ALLUNLOCK: { m_LockDeskDlg.SetInfo(2, 1, m_pCurrentRoom->m_RoomInfo->uDeskCount); m_LockDeskDlg.DoModal(); break; } case MSG_CMD_GM_PRINTLOG: { HTREEITEM hSel = m_GameListTreeCtrl.GetSelectedItem(); CNodeType* pType = (CNodeType*)m_GameListTreeCtrl.GetItemData(hSel); if (pType->m_uDataType == GLK_GAME_ROOM) { CGameRoomItem* pRoom = (CGameRoomItem*)pType; GM_MSG_PrintLog_t tagPrintLog; tagPrintLog.uRoomID = pRoom->m_RoomInfo->uRoomID; m_wSocket.SendPrintLogCmd(&tagPrintLog); } } break;; } return CDialog::OnCommand(wParam, lParam); }
void CGameManageDlg::OnGetUser(GM_OperatedPlayerInfo_t* user) { switch (m_OperaState) { case 1: { m_AWardDlg.SetUserInfo(user); m_AWardDlg.SetAwardList(*m_PropList); m_AWardDlg.SetAwardProjectList(*m_AwardType); m_AWardDlg.DoModal(); break; } case 2: case 3: case 4: { m_OperateDlg.SetUserInfo(user); m_OperateDlg.SetOperateType(m_OperaState); m_OperateDlg.DoModal(); break; } case 5: { if (user->ZID != 0) { bool flag = false; for (vector<CChatDlg*>::iterator i = m_ChatDlgs.begin(); i != m_ChatDlgs.end();) { if ((*i)->m_iUserID != -1 && (*i)->m_iUserID == user->iUserID) { flag = true; (*i)->ShowWindow(SW_SHOW); } if ((*i)->m_iUserID == -1) { (*i)->DestroyWindow(); delete (*i); i = m_ChatDlgs.erase(i); } else i++; } if (!flag) { CChatDlg* ChatDlg = new CChatDlg; ChatDlg->SetUserInfo(user); ChatDlg->Create(IDD_DIALOG6, this); ChatDlg->ShowWindow(SW_SHOW); m_ChatDlgs.push_back(ChatDlg); } } else { AfxMessageBox("该用户不在线!"); } break; } case 6: { m_BroadDlg.DoModal(); break; } } }