Beispiel #1
0
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;
}
Beispiel #2
0
void CEmoticonDlg::OnButtonSend() 
{
	m_bHideWhenInactive = FALSE;
	if (m_listEmoticon.GetSelectedCount() == 0)
	{
		MessageBox("select emoticon!");
	}
	else
	{
		POSITION pos = m_listEmoticon.GetFirstSelectedItemPosition();
		if (pos)
		{
			LVITEM item = {0};
			item.iItem = m_listEmoticon.GetNextSelectedItem(pos);
			item.mask = LVIF_PARAM;
			m_listEmoticon.GetItem(&item);

			CChatDlg* pParent = (CChatDlg*) this->GetParent();
			pParent->SendEmoticon((Pattern*) item.lParam);
		}
	}
	m_bHideWhenInactive = TRUE;
}
Beispiel #3
0
BOOL CChatApp::InitInstance()
{
	if (!AfxSocketInit()){
		AfxMessageBox(_T("加载套接字失败"));
		return false;
	}
	// 如果一个运行在 Windows XP 上的应用程序清单指定要
	// 使用 ComCtl32.dll 版本 6 或更高版本来启用可视化方式,
	//则需要 InitCommonControlsEx()。  否则,将无法创建窗口。
	INITCOMMONCONTROLSEX InitCtrls;
	InitCtrls.dwSize = sizeof(InitCtrls);
	// 将它设置为包括所有要在应用程序中使用的
	// 公共控件类。
	InitCtrls.dwICC = ICC_WIN95_CLASSES;
	InitCommonControlsEx(&InitCtrls);

	CWinApp::InitInstance();


	AfxEnableControlContainer();

	// 创建 shell 管理器,以防对话框包含
	// 任何 shell 树视图控件或 shell 列表视图控件。
	CShellManager *pShellManager = new CShellManager;

	// 激活“Windows Native”视觉管理器,以便在 MFC 控件中启用主题
	CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows));

	// 标准初始化
	// 如果未使用这些功能并希望减小
	// 最终可执行文件的大小,则应移除下列
	// 不需要的特定初始化例程
	// 更改用于存储设置的注册表项
	// TODO:  应适当修改该字符串,
	// 例如修改为公司或组织名
	SetRegistryKey(_T("应用程序向导生成的本地应用程序"));

	CChatDlg dlg;
	m_pMainWnd = &dlg;
	INT_PTR nResponse = dlg.DoModal();
	if (nResponse == IDOK)
	{
		// TODO:  在此放置处理何时用
		//  “确定”来关闭对话框的代码
	}
	else if (nResponse == IDCANCEL)
	{
		// TODO:  在此放置处理何时用
		//  “取消”来关闭对话框的代码
	}
	else if (nResponse == -1)
	{
		TRACE(traceAppMsg, 0, "警告: 对话框创建失败,应用程序将意外终止。\n");
		TRACE(traceAppMsg, 0, "警告: 如果您在对话框上使用 MFC 控件,则无法 #define _AFX_NO_MFC_CONTROLS_IN_DIALOGS。\n");
	}

	// 删除上面创建的 shell 管理器。
	if (pShellManager != NULL)
	{
		delete pShellManager;
	}

	// 由于对话框已关闭,所以将返回 FALSE 以便退出应用程序,
	//  而不是启动应用程序的消息泵。
	return FALSE;
}
Beispiel #4
0
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);
}
Beispiel #5
0
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;
		}

	}
}