示例#1
0
//叫分按钮
void CGameClientView::OnBrightCard()
{
	AfxGetMainWnd()->SendMessage(IDM_LAND_SCORE,5,5);
	return;
}
示例#2
0
//登录消息
bool CPlazaViewItem::OnSocketMainLogon(CMD_Command Command, void * pData, WORD wDataSize)
{
	switch (Command.wSubCmdID)
	{
	case SUB_GP_LOGON_SUCCESS:		//登录成功
		{
			//效验参数
			ASSERT(wDataSize>=sizeof(CMD_GP_LogonSuccess));
			if (wDataSize<sizeof(CMD_GP_LogonSuccess)) return false;

			//保存信息
			tagGlobalUserData & UserData=g_GlobalUnits.GetGolbalUserData();
			CMD_GP_LogonSuccess * pLogonSuccess=(CMD_GP_LogonSuccess *)pData;
			UserData.wFaceID=pLogonSuccess->wFaceID;
			UserData.cbGender=pLogonSuccess->cbGender;
			UserData.cbMember=pLogonSuccess->cbMember;
			UserData.dwUserID=pLogonSuccess->dwUserID;
			UserData.dwGameID=pLogonSuccess->dwGameID;
			UserData.dwExperience=pLogonSuccess->dwExperience;
			UserData.dwCustomFaceVer=pLogonSuccess->dwCustomFaceVer;

			//扩展信息
			void * pDataBuffer=NULL;
			tagDataDescribe DataDescribe;
			CRecvPacketHelper RecvPacket(pLogonSuccess+1,wDataSize-sizeof(CMD_GP_LogonSuccess));
			while (true)
			{
				pDataBuffer=RecvPacket.GetData(DataDescribe);
				if (DataDescribe.wDataDescribe==DTP_NULL) break;
				switch (DataDescribe.wDataDescribe)
				{
				case DTP_USER_ACCOUNTS:		//用户帐户
					{
						ASSERT(pDataBuffer!=NULL);
						ASSERT(DataDescribe.wDataSize>0);
						ASSERT(DataDescribe.wDataSize<=sizeof(UserData.szAccounts));
						if (DataDescribe.wDataSize<=sizeof(UserData.szAccounts))
						{
							CopyMemory(UserData.szAccounts,pDataBuffer,DataDescribe.wDataSize);
							UserData.szAccounts[CountArray(UserData.szAccounts)-1]=0;
						}
						break;
					}
				case DTP_USER_PASS:			//用户密码
					{
						ASSERT(pDataBuffer!=NULL);
						ASSERT(DataDescribe.wDataSize>0);
						ASSERT(DataDescribe.wDataSize<=sizeof(UserData.szPassWord));
						if (DataDescribe.wDataSize<=sizeof(UserData.szPassWord))
						{
							CopyMemory(UserData.szPassWord,pDataBuffer,DataDescribe.wDataSize);
							UserData.szPassWord[CountArray(UserData.szPassWord)-1]=0;
						}
						break;
					}
				case DTP_UNDER_WRITE:		//个性签名
					{
						ASSERT(pDataBuffer!=NULL);
						ASSERT(DataDescribe.wDataSize>0);
						ASSERT(DataDescribe.wDataSize<=sizeof(UserData.szUnderWrite));
						if (DataDescribe.wDataSize<=sizeof(UserData.szUnderWrite))
						{
							CopyMemory(UserData.szUnderWrite,pDataBuffer,DataDescribe.wDataSize);
							UserData.szUnderWrite[CountArray(UserData.szUnderWrite)-1]=0;
						}
						break;
					}
				case DTP_USER_GROUP_NAME:	//社团名字
					{
						ASSERT(pDataBuffer!=NULL);
						ASSERT(DataDescribe.wDataSize>0);
						ASSERT(DataDescribe.wDataSize<=sizeof(UserData.szGroupName));
						if (DataDescribe.wDataSize<=sizeof(UserData.szGroupName))
						{
							CopyMemory(UserData.szGroupName,pDataBuffer,DataDescribe.wDataSize);
							UserData.szGroupName[CountArray(UserData.szGroupName)-1]=0;
						}
						break;
					}
				case DTP_STATION_PAGE:		//游戏主站
					{
						ASSERT(pDataBuffer!=NULL);
						if (pDataBuffer!=NULL) 
						{
							g_GlobalUnits.SetStationPage((LPCTSTR)pDataBuffer);
							m_pHtmlBrower->Navigate(g_GlobalUnits.GetStationPage());
						}
						break;
					}
				default: { ASSERT(FALSE); }
				}
			}

			//设置提示
			g_GlobalAttemper.ShowStatusMessage(TEXT("正在读取服务器列表信息..."),this);

			return true;
		}
	case SUB_GP_LOGON_ERROR:		//登录失败
		{
			//效验参数
			CMD_GP_LogonError *pLogonError = (CMD_GP_LogonError *)pData;
			ASSERT(wDataSize>=(sizeof(CMD_GP_LogonError)-sizeof(pLogonError->szErrorDescribe)));
			if (wDataSize<(sizeof(CMD_GP_LogonError)-sizeof(pLogonError->szErrorDescribe))) return false;

			//关闭连接
			g_GlobalAttemper.DestroyStatusWnd(this);
			m_ClientSocket->CloseSocket();

			//显示消息
			WORD wDescribeSize=wDataSize-(sizeof(CMD_GP_LogonError)-sizeof(pLogonError->szErrorDescribe));
			if (wDescribeSize>0)
			{
				pLogonError->szErrorDescribe[wDescribeSize-1]=0;
				ShowMessageBox(pLogonError->szErrorDescribe,MB_ICONINFORMATION);
			}

			//发送登录
			SendLogonMessage();

			return true;
		}
	case SUB_GP_LOGON_FINISH:		//登录完成
		{
			//关闭提示
			g_GlobalAttemper.DestroyStatusWnd(this);

			//展开类型
			INT_PTR nIndex=0;
			CListType * pListType=NULL;
			do
			{
				pListType=g_GlobalUnits.m_ServerListManager.EnumTypeItem(nIndex++);
				if (pListType==NULL) break;
				g_GlobalUnits.m_ServerListManager.ExpandListItem(pListType);
			} while (true);

			//展开列表
			nIndex=0;
			CListInside * pListInside=NULL;
			do
			{
				pListInside=g_GlobalUnits.m_ServerListManager.EnumInsideItem(nIndex++);
				if (pListInside==NULL) break;
				g_GlobalUnits.m_ServerListManager.ExpandListItem(pListInside);
			} while (true);

			//记录信息
			m_bLogonPlaza=true;
			m_DlgLogon.OnLogonSuccess();
			m_pHtmlBrower->EnableBrowser(true);

			//记录信息
			g_GlobalUnits.WriteUserCookie();

			//显示头像
			((CGameFrame*)AfxGetMainWnd())->m_UserInfoView.ShowUserInfo(true);

			//自定义判断
			tagGlobalUserData &GlobalUserData = g_GlobalUnits.GetGolbalUserData();
			if ( GlobalUserData.dwCustomFaceVer!=0)
			{
				//头像名称
				CString strDirName = CString(g_GlobalUnits.GetWorkDirectory()) + TEXT("\\CustomFace");
				CString strFileName;
				strFileName.Format(TEXT("\\%ld_%d.bmp"), GlobalUserData.dwUserID, GlobalUserData.dwCustomFaceVer);

				//读取文件
				CImage FaceImage;
				HRESULT hResult = FaceImage.Load(strDirName + strFileName);
				if (SUCCEEDED(hResult))
				{
					//关闭连接
					m_ClientSocket->CloseSocket();

					FaceImage.Destroy();
				}
				//下载头像
				else
				{
					PostMessage(WM_DOWN_LOAD_FACE, LPARAM(GlobalUserData.dwCustomFaceVer), WPARAM(GlobalUserData.dwUserID));
				}
			}
			else
			{
				//关闭连接
				m_ClientSocket->CloseSocket();
			}

			return true;
		}
	}

	return true;
}
示例#3
0
//用户消息
bool CPlazaViewItem::OnSocketMainUser(CMD_Command Command, void * pBuffer, WORD wDataSize)
{
	ASSERT(Command.wMainCmdID == MDM_GP_USER);
	switch(Command.wSubCmdID)
	{
	case SUB_GP_USER_DOWNLOAD_FACE:			//下载头像
		{
			//类型转换
			CMD_GP_DownloadFaceSuccess *pDownloadFaceSuccess = (CMD_GP_DownloadFaceSuccess*)pBuffer;

			//参数验证
			WORD wSendSize = WORD(pDownloadFaceSuccess->dwCurrentSize + sizeof(CMD_GP_DownloadFaceSuccess) - sizeof(pDownloadFaceSuccess->bFaceData));
			ASSERT(wDataSize == wSendSize);
			if ( wDataSize != wSendSize ) return false;

			//第一次判断
			if ( m_CustomFace.pFaceData == NULL )
			{
				if ( m_CustomFace.pFaceData != NULL ) delete[] m_CustomFace.pFaceData;
				m_CustomFace.pFaceData = new BYTE[pDownloadFaceSuccess->dwToltalSize];
				if ( m_CustomFace.pFaceData == NULL ) return true;
				m_CustomFace.dwFaceSize = pDownloadFaceSuccess->dwToltalSize;
				m_CustomFace.dwUserID = pDownloadFaceSuccess->dwUserID;
			}

			//拷贝数据
			CopyMemory(m_CustomFace.pFaceData+m_CustomFace.dwCurrentSize, pDownloadFaceSuccess->bFaceData, pDownloadFaceSuccess->dwCurrentSize);
			m_CustomFace.dwCurrentSize += pDownloadFaceSuccess->dwCurrentSize;

			//下载完毕
			if ( m_CustomFace.dwFaceSize == m_CustomFace.dwCurrentSize )
			{
				tagDownloadInfo &DownloadInfo = m_DownloadInfoArrary[0];

				//创建目录
				CString strDirName = CString(g_GlobalUnits.GetWorkDirectory()) + TEXT("\\CustomFace");
				CreateDirectory(strDirName, NULL) ;

				//写入文件
				CFile fileFace;
				CString strZipFileName, strBmpFileName;
				strZipFileName.Format(TEXT("\\%ld_%d.zip"), DownloadInfo.dwUserID, DownloadInfo.bFaceVer);
				strBmpFileName.Format(TEXT("\\%ld_%d.bmp"), DownloadInfo.dwUserID, DownloadInfo.bFaceVer);
				if ( fileFace.Open(strDirName + strZipFileName, CFile::modeCreate|CFile::modeWrite|CFile::typeBinary) )
				{
					fileFace.Write(m_CustomFace.pFaceData, m_CustomFace.dwFaceSize);
					fileFace.Close();

					//解压文件
					CUnzip oUnzip( strDirName + strZipFileName );
					oUnzip.SwapSize( strDirName + strBmpFileName );

					//删除文件
					CFile::Remove(strDirName + strZipFileName);
				}

				//自己判断
				tagGlobalUserData &GlobalUserData = g_GlobalUnits.GetGolbalUserData();
				if ( GlobalUserData.dwUserID ==  DownloadInfo.dwUserID )
				{
					//更新界面
					((CGameFrame*)AfxGetMainWnd())->m_UserInfoView.UpdateUserInfo();
				}

				//重置变量
				m_CustomFace.Clear();

				//删除元素
				m_DownloadInfoArrary.RemoveAt(0);

				//继续判断
				if ( 0 < m_DownloadInfoArrary.GetCount() )
				{
					//状态判断
					if ( m_ClientSocket->GetSocketStatus() != SOCKET_STATUS_CONNECT )
					{
						//链接网络
						if ( ! ConnectServer() ) return true;

						//设置标识
						m_bDownloadConnect = true;
					}

					//投递请求
					tagDownloadInfo &DownloadInfo = m_DownloadInfoArrary[0];

					CMD_GP_DownloadFace DownloadFace;
					DownloadFace.dwUserID = DownloadInfo.dwUserID;
					m_ClientSocket->SendData(MDM_GP_USER, SUB_GP_USER_DOWNLOAD_FACE, &DownloadFace, sizeof(DownloadFace));
				}
				else
				{
					//关闭链接
					m_ClientSocket->CloseSocket();

					//设置变量
					m_bStartDownloadFace=false;
				}
			}
			return true;
		}
	case SUB_GP_UPLOAD_FACE_RESULT:		//上传结果
		{
			ASSERT(sizeof(CMD_GP_UploadFaceResult) == wDataSize);
			if ( sizeof(CMD_GP_UploadFaceResult) != wDataSize) return true;

			//显示消息
			CMD_GP_UploadFaceResult *pUploadFaceResult = (CMD_GP_UploadFaceResult*)pBuffer;
			ShowMessageBox(pUploadFaceResult->szDescribeMsg, MB_ICONINFORMATION);

			//成功判断
			if ( pUploadFaceResult->bOperateSuccess )
			{
				//头像目录
				CString strDirName = CString(g_GlobalUnits.GetWorkDirectory()) + TEXT("\\CustomFace");
				CString strOldFileName;
				strOldFileName = TEXT("\\MyFace.bmp");

				//命名文件
				tagGlobalUserData &GlobalUserData = g_GlobalUnits.GetGolbalUserData();
				CString strNemFileName;
				strNemFileName.Format(TEXT("\\%ld_%d.bmp"), GlobalUserData.dwUserID, pUploadFaceResult->dwFaceVer);

				//删除文件
				try
				{
				CFile::Remove(strDirName + strNemFileName);
				}
				catch(...){}

				//删除文件
				CString strOldFile;
				strOldFile.Format(TEXT("\\%ld_%ld.bmp"), GlobalUserData.dwUserID, GlobalUserData.dwCustomFaceVer);
				try
				{
					CFile::Remove(strDirName + strOldFile);
				}
				catch(...){}

				try
				{
					CFile::Rename(strDirName + strOldFileName, strDirName + strNemFileName);

					//设置版本号
					GlobalUserData.dwCustomFaceVer = pUploadFaceResult->dwFaceVer;
					ASSERT(GlobalUserData.dwCustomFaceVer!=0);

					//投递消息
					for ( INT nIndex = 0; nIndex < MAX_SERVER; nIndex++ ) 
					{
						CRoomViewItem *pRoomViewItem = ((CGameFrame*)AfxGetMainWnd())->m_pRoomViewItem[nIndex];
						if ( pRoomViewItem == NULL ) continue;
						pRoomViewItem->SendMessage(WM_UPDATE_FACE, GlobalUserData.dwCustomFaceVer, GlobalUserData.dwUserID);
					}
				}
				catch(...)
				{
					ShowMessageBox(TEXT("头像文件命名失败,需要重新登录才可以显示新头像!"), MB_ICONINFORMATION);
				}

				//更新界面
				((CGameFrame*)AfxGetMainWnd())->m_UserInfoView.UpdateUserInfo();

				//设置界面
				CGameFrame *pGameFrame = (CGameFrame *)AfxGetMainWnd() ;
				CDlgCustomFace &DlgCustomFace = pGameFrame->m_DlgCustomFace;
				if ( DlgCustomFace.m_hWnd != NULL && DlgCustomFace.IsWindowVisible() )
				{
					DlgCustomFace.UpdateControls();
					DlgCustomFace.SetFocus();
				}
			}

			//关闭链接
			m_ClientSocket->CloseSocket();

			return true;
		}
	case SUB_GP_DELETE_FACE_RESULT:		//删除结果
		{
			ASSERT(sizeof(CMD_GP_DeleteFaceResult) == wDataSize);
			if ( sizeof(CMD_GP_DeleteFaceResult) != wDataSize) return true;

			//显示消息
			CMD_GP_DeleteFaceResult *pDeleteFaceResult = (CMD_GP_DeleteFaceResult*)pBuffer;
			ShowMessageBox(pDeleteFaceResult->szDescribeMsg, MB_ICONINFORMATION);

			//成功判断
			if ( pDeleteFaceResult->bOperateSuccess )
			{
				//获取信息
				tagGlobalUserData &GlobalUserData = g_GlobalUnits.GetGolbalUserData();

				//文件目录
				CString strDirName = CString(g_GlobalUnits.GetWorkDirectory()) + TEXT("\\CustomFace");

				//文件名字
				CString strFileName;
				strFileName.Format(TEXT("\\%ld_%d.bmp"), GlobalUserData.dwUserID, pDeleteFaceResult->dwFaceVer);

				//删除文件
				try
				{
				CFile::Remove(strDirName + strFileName);
				}
				catch(...){}
				
				//更新界面
				((CGameFrame*)AfxGetMainWnd())->m_UserInfoView.UpdateUserInfo();

				//设置界面
				CGameFrame *pGameFrame = (CGameFrame *)AfxGetMainWnd() ;
				CDlgCustomFace &DlgCustomFace = pGameFrame->m_DlgCustomFace;
				if ( DlgCustomFace.m_hWnd != NULL && DlgCustomFace.IsWindowVisible() )
				{
					DlgCustomFace.UpdateControls();
					DlgCustomFace.SetFocus();
				}
				
				//投递消息
				for ( INT nIndex = 0; nIndex < MAX_SERVER; nIndex++ ) 
				{
					CRoomViewItem *pRoomViewItem = ((CGameFrame*)AfxGetMainWnd())->m_pRoomViewItem[nIndex];
					if ( pRoomViewItem == NULL ) continue;
					pRoomViewItem->SendMessage(WM_UPDATE_FACE, GlobalUserData.dwCustomFaceVer, GlobalUserData.dwUserID);
				}
			}
			
			//关闭链接
			m_ClientSocket->CloseSocket();

			return true;
		}
	case SUB_GP_MODIFY_INDIVIDUAL_RESULT:	//修改结果
		{
			return true;
		}
	default:
		{
			ASSERT(FALSE);
			return false;
		}
	}
	return true;
}
示例#4
0
// 用于应用程序“关于”菜单项的 CAboutDlg 对话框
UINT ThreadFun(LPVOID pParam){  //线程要调用的函数
   WSADATA wsd;
   int len=sizeof(struct sockaddr_in);
   int ret;
	TCHAR recvbuf[BUFSIZE];
   if(WSAStartup(MAKEWORD(2,2),&wsd)!=0)
   {
	   printf("WSAStartup()failed\n");
	   return -1;
   }
   if((sock=WSASocket(AF_INET,SOCK_DGRAM,0,NULL,0,
	   WSA_FLAG_MULTIPOINT_C_LEAF|WSA_FLAG_MULTIPOINT_D_LEAF|
	   WSA_FLAG_OVERLAPPED))==INVALID_SOCKET)
   {
	   printf("socket failed with :%d\n",WSAGetLastError());
	   WSACleanup();
	   return -1;
   }
   //将sock绑定到本机端口上
   local.sin_family=AF_INET;
   local.sin_port=htons(MCASTPORT);
   local.sin_addr.s_addr=INADDR_ANY;

   if(bind(sock,(struct sockaddr*)&local,sizeof(local))==SOCKET_ERROR)
   {
	   printf("bind failed with %d\n",WSAGetLastError());
	   closesocket(sock);
	   WSACleanup();
	   return -1;
   
   
   }
   //加入多播组

   remote.sin_family=AF_INET;
   remote.sin_port=htons(MCASTPORT);
   remote.sin_addr.s_addr=inet_addr(MCASTADDR);

   if((sockM=WSAJoinLeaf(sock,(SOCKADDR*)&remote,sizeof(remote),
	   NULL,NULL,NULL,NULL,
	   JL_BOTH))==INVALID_SOCKET)
   {
     printf("WSAJoinLeaf()failed:%d\n",WSAGetLastError());
     closesocket(sock);
	 WSACleanup();
	 return -1;
   }
   //接收多播数据,当收到的数据为QUIT时退出

   while(1)
   {
	   if((ret=recvfrom(sock,recvbuf,BUFSIZE,0,
		   (struct sockaddr*)&from,&len))==SOCKET_ERROR)
	   {
		   //printf("recvfrom failed with :%d\n",WSAGetLastError());
		   closesocket(sockM);
		   closesocket(sock);
		   WSACleanup();
		   return -1;
	   }
	   if(strcmp(recvbuf,"QUIT")==0)  break;
	   else{
		   recvbuf[ret]='\0';
		   Str+=inet_ntoa(from.sin_addr);
		   Str+=":";
		   Str+=recvbuf;
		   Str+="\r\n";
		   HWND hWnd = GetDlgItem(AfxGetMainWnd()->m_hWnd,IDC_EDIT1);
		   CWnd *pWnd = CWnd::FromHandle(hWnd);
		   pWnd->SetWindowText(_T(Str));

	   }
   }

   closesocket(sockM);
   closesocket(sock);
   WSACleanup();
   return 0;
}
示例#5
0
void CDataView::OnEditPaste() 
{
	m_Grid.OnEditPaste();
	CGAMDoc *pDoc = (CGAMDoc*)(((CMainFrame *)AfxGetMainWnd())->GetActiveDocument());
	pDoc->SetModifiedFlag();
}
void CFMDischargedPaidPatientListByDay::OnDeptListSelectChange(int nOldItem, int nNewItem){
	CHMSMainFrame *pMF = (CHMSMainFrame*) AfxGetMainWnd();
	
} 
示例#7
0
void CMyClientMainView::OnRclick(NMHDR* pNMHDR, LRESULT* pResult) 
{
	*pResult = 0;
	AfxGetMainWnd()->PostMessage
		(WM_CLIENTMAINRCLICK,IDR_MENU_CLIENT_MANAGER,NULL);
}
示例#8
0
//放弃按钮
void CGameClientView::OnGiveUpScore()
{
	AfxGetMainWnd()->SendMessage(IDM_LAND_SCORE,255,255);
	return;
}
示例#9
0
//出牌提示
void CGameClientView::OnAutoOutCard()
{
	AfxGetMainWnd()->SendMessage(IDM_AUTO_OUTCARD,0,0);
	return;
}
示例#10
0
//出牌按钮
void CGameClientView::OnOutCard()
{
	AfxGetMainWnd()->SendMessage(IDM_OUT_CARD,1,1);
	return;
}
示例#11
0
//放弃按钮
void CGameClientView::OnPassCard()
{
	AfxGetMainWnd()->SendMessage(IDM_PASS_CARD,1,1);
	return;
}
示例#12
0
//加倍消息
void CGameClientView::OnNotDoubleScore()
{
	//发送消息
	AfxGetMainWnd()->SendMessage(IDM_DOUBLE_SCORE, 1, 1);
}
示例#13
0
//建立消息
int CGameClientView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (__super::OnCreate(lpCreateStruct)==-1) return -1;

	//创建控件
	CRect CreateRect(0,0,0,0);

	//创建扑克
	for (WORD i=0;i<3;i++)
	{
		//用户扑克
		if ( i == 1 )
			m_UserCardControl[i].SetDirection(true);
		else
			m_UserCardControl[i].SetDirection(false);
			
		m_UserCardControl[i].SetDisplayFlag(true);	
		m_UserCardControl[i].SetCardSpace( 16, 20, 16 );

		m_UserCardControl[i].Create(NULL,NULL,WS_VISIBLE|WS_CHILD,CreateRect,this,20+i);

		//用户扑克
		if (i!=1)
		{
			m_HandCardControl[i].SetCardSpace(0,18,0);
			m_HandCardControl[i].SetDirection(false);
			m_HandCardControl[i].SetDisplayFlag(false);
			m_HandCardControl[i].Create(NULL,NULL,WS_VISIBLE|WS_CHILD,CreateRect,this,30+i);
		}
		else
		{
			m_HandCardControl[i].SetDirection(true);
			m_HandCardControl[i].SetDisplayFlag(false);
			m_HandCardControl[i].Create(NULL,NULL,WS_VISIBLE|WS_CHILD,CreateRect,this,30+i);
		}
	}

	//设置扑克
	m_BackCardControl.SetCardSpace(85,0,0);
	m_BackCardControl.SetDisplayFlag(false);
	m_HandCardControl[1].SetSinkWindow(AfxGetMainWnd());
	m_BackCardControl.Create(NULL,NULL,WS_VISIBLE|WS_CHILD,CreateRect,this,41);

	//创建按钮
	m_btStart.Create(TEXT(""),WS_CHILD,CreateRect,this,IDC_START);
	m_btOutCard.Create(TEXT(""),WS_CHILD,CreateRect,this,IDC_OUT_CARD);
	m_btPassCard.Create(TEXT(""),WS_CHILD,CreateRect,this,IDC_PASS_CARD);
	m_btOneScore.Create(TEXT(""),WS_CHILD,CreateRect,this,IDC_ONE_SCORE);
	m_btTwoScore.Create(TEXT(""),WS_CHILD,CreateRect,this,IDC_TWO_SCORE);
	m_btGiveUpScore.Create(TEXT(""),WS_CHILD,CreateRect,this,IDC_GIVE_UP_SCORE);
	m_btAutoOutCard.Create(TEXT(""),WS_CHILD,CreateRect,this,IDC_AUTO_OUTCARD);
	m_btThreeScore.Create(TEXT(""),WS_CHILD,CreateRect,this,IDC_THREE_SCORE);
	m_btAutoPlayOn.Create(TEXT(""), WS_CHILD ,CreateRect,this,IDC_AUTOPLAY_ON);
	m_btAutoPlayOff.Create(TEXT(""),WS_CHILD,CreateRect,this,IDC_AUTOPLAY_OFF);
	m_btSortCard.Create(NULL,WS_CHILD|WS_DISABLED|WS_VISIBLE,CreateRect,this,IDC_SORT_CARD);

	//扩展按钮
	m_btSnatchLand.Create(TEXT(""),WS_CHILD,CreateRect,this,IDC_SNATCH_LAND);
	m_btBrightCard.Create(TEXT(""),WS_CHILD,CreateRect,this,IDC_BRIGHT_CARD);	
	m_btBrightStart.Create(TEXT(""),WS_CHILD,CreateRect,this,IDC_BRIGHT_START);
	m_btDoubleScore.Create(TEXT(""),WS_CHILD,CreateRect,this,IDC_DOUBLE_SCORE);
	m_btNotDoubleScore.Create(TEXT(""),WS_CHILD,CreateRect,this,IDC_NOT_DOUBLE_SCORE);
    
	//设置按钮
	HINSTANCE hInstance=AfxGetInstanceHandle();
	m_btStart.SetButtonImage(IDB_START,hInstance,false);
	m_btOutCard.SetButtonImage(IDB_OUT_CARD,hInstance,false);
	m_btPassCard.SetButtonImage(IDB_PASS,hInstance,false);
	m_btOneScore.SetButtonImage(IDB_ONE_SCORE,hInstance,false);
	m_btTwoScore.SetButtonImage(IDB_TWO_SCORE,hInstance,false);
	m_btGiveUpScore.SetButtonImage(IDB_GIVE_UP,hInstance,false);
	m_btAutoOutCard.SetButtonImage(IDB_AUTO_OUT_CARD,hInstance,false);
	m_btThreeScore.SetButtonImage(IDB_THREE_SCORE,hInstance,false);
	m_btAutoPlayOn.SetButtonImage  (IDB_AUTOPLAY_ON,hInstance,false);
	m_btAutoPlayOff.SetButtonImage (IDB_AUTOPLAY_OFF,hInstance,false);
	m_btSortCard.SetButtonImage(IDB_COUNT_SORT,hInstance,false);
	m_btSnatchLand.SetButtonImage(IDB_SNATCH_LAND,hInstance,false);
	m_btBrightCard.SetButtonImage(IDB_BRIGHT_CARD,hInstance,false);
	m_btBrightStart.SetButtonImage(IDB_BRIGHT_CARD_START, hInstance, false);
	m_btDoubleScore.SetButtonImage(IDB_DOUBLE_SCORE, hInstance, false);
	m_btNotDoubleScore.SetButtonImage(IDB_NOT_DOUBLE_SCORE, hInstance, false);
    
    m_btAutoPlayOn.ShowWindow(SW_SHOW);
    m_btAutoPlayOff.ShowWindow(SW_HIDE);

	//创建控件
	m_ScoreView.Create(IDD_GAME_SCORE,this);

	//隐藏扑克
	//m_HandCardControl[ 0 ].ShowWindow( SW_HIDE );
	//m_HandCardControl[ 2 ].ShowWindow( SW_HIDE );

#ifdef VIDEO_GAME

	//创建视频
	for (WORD i=0; i<GAME_PLAYER; i++)
	{
		//创建视频
		m_DlgVedioService[i].Create(NULL,NULL,WS_CHILD|WS_VISIBLE,CreateRect,this,200+i);
		m_DlgVedioService[i].InitVideoService(i==1,i==1);

		//设置视频
		m_VedioServiceManager.SetVideoServiceControl(i,&m_DlgVedioService[i]);
	}	

#endif

	return 0;
}
示例#14
0
//明牌开始
void CGameClientView::OnBrightStart()
{
	AfxGetMainWnd()->SendMessage(IDM_BRIGHT_START,0,0);
	return;
}
/*void CFMDischargedPaidPatientListByDay::OnStaffAddNew(){
	CMainFrame *pMF = (CMainFrame*) AfxGetMainWnd();
	
} */
void CFMDischargedPaidPatientListByDay::OnPrintSelect()
{
	CHMSMainFrame *pMF = (CHMSMainFrame*) AfxGetMainWnd();
	UpdateData(true);
	CReport rpt;
	CReportSection *rptDetail;
	CRecord rs(&pMF->m_db);
	CString szSQL, tmpStr, szTemp, szSysDate, szOldLine, szNewLine, szObjectNames;
	bool bCheckServ = false, bCheckIns = false;
	long double nGroupTotal[12];
	long double nTotal[12];
	double nCost;
	int nIndex = 1;
	CStringArray strArr;
	szSQL = GetQueryString();
	BeginWaitCursor();
	rs.ExecSQL(szSQL);

	if (rs.IsEOF())
	{
		ShowMessageBox(_T("No Data"), MB_OK | MB_ICONERROR);
		return;
	}
	
	if (!rpt.Init(_T("Reports/HMS/HF_DANHSACHBENHNHANRAVIENDATHANHTOAN.RPT")))
		return;
	rpt.GetReportHeader()->SetValue(_T("HEALTHSERVICE"), pMF->m_CompanyInfo.sc_pname);
	rpt.GetReportHeader()->SetValue(_T("HOSPITALNAME"), pMF->m_CompanyInfo.sc_name);
	rpt.GetReportHeader()->SetValue(_T("Department"), pMF->GetCurrentDepartmentName());
	tmpStr.Format(rpt.GetReportHeader()->GetValue(_T("ReportDate")), CDateTime::Convert(m_szFromDate, yyyymmdd|hhmm, ddmmyyyy|hhmm),
	CDateTime::Convert(m_szToDate, yyyymmdd|hhmm, ddmmyyyy|hhmm));

	rpt.GetReportHeader()->SetValue(_T("ReportDate"), tmpStr);

	strArr.Add(_T("\x64\x1ECB\x63h v\x1EE5"));
	strArr.Add(_T("\x42\x110 - \x43S - \x42H"));
	for(int i = 0; i < 12; i++)
	{
		nGroupTotal[i] = 0;
		nTotal[i] = 0;
	}
	while (!rs.IsEOF())
	{
		rs.GetValue(_T("ngayra"), tmpStr);
		szNewLine = CDate::Convert(tmpStr, yyyymmdd, ddmmyyyy);
		if (!szNewLine.IsEmpty() && szNewLine != szOldLine)
		{
			if (nGroupTotal[9] > 0)
			{
				rptDetail = rpt.AddDetail(rpt.GetGroupFooter(1));
				//TranslateString(_T("\x43\x1ED9ng kho\x61"), tmpStr);
				rptDetail->SetValue(_T("TotalGroup"), _T("\x43\x1ED9ng kho\x61"));
				for(int i = 8; i < 12; i++)
				{
					FormatCurrency(nGroupTotal[i], tmpStr);
					szTemp.Format(_T("s%d"), i);
					rptDetail->SetValue(szTemp, tmpStr);
					nTotal[i] += nGroupTotal[i];
					nGroupTotal[i] = 0;
				}
			}
			szOldLine = szNewLine;
		}
		rptDetail = rpt.AddDetail();

		tmpStr.Format(_T("%d"), nIndex++);
		rptDetail->SetValue(_T("1"), tmpStr);

		rs.GetValue(_T("pname"), tmpStr);
		rptDetail->SetValue(_T("2"), tmpStr);

		rs.GetValue(_T("docno"), tmpStr);
		rptDetail->SetValue(_T("3"), tmpStr);

		rs.GetValue(_T("recordno"), tmpStr);
		rptDetail->SetValue(_T("4"), tmpStr);

		rs.GetValue(_T("ngayvao"), tmpStr);
		szTemp = CDate::Convert(tmpStr, yyyymmdd, ddmmyyyy);
		rptDetail->SetValue(_T("5"), szTemp);
		
		if (nGroupTotal[9] == 0)
		{
			rs.GetValue(_T("ngayra"), tmpStr);
			szTemp = CDate::Convert(tmpStr, yyyymmdd, ddmmyyyy);
			rptDetail->SetValue(_T("6"), szTemp);
		}

		rs.GetValue(_T("deptid"), tmpStr);
		rptDetail->SetValue(_T("7"), tmpStr);
		
		rs.GetValue(_T("deposit"), nCost);
		nGroupTotal[8] += nCost;
		FormatCurrency(nCost, tmpStr);
		rptDetail->SetValue(_T("8"), tmpStr);

		rs.GetValue(_T("feeamt"), nCost);
		nGroupTotal[9] += nCost;
		FormatCurrency(nCost, tmpStr);
		rptDetail->SetValue(_T("9"), tmpStr);

		rs.GetValue(_T("thu"), nCost);
		nGroupTotal[10] += nCost;
		FormatCurrency(nCost, tmpStr);
		rptDetail->SetValue(_T("10"), tmpStr);
		
		rs.GetValue(_T("chi"), nCost);
		nGroupTotal[11] += nCost;
		FormatCurrency(nCost, tmpStr);
		rptDetail->SetValue(_T("11"), tmpStr);
		
		rs.MoveNext();
	}

	if (nGroupTotal[9] > 0)
	{
		rptDetail = rpt.AddDetail(rpt.GetGroupFooter(1));
		//TranslateString(_T("\x43\x1ED9ng kho\x61"), tmpStr);
		rptDetail->SetValue(_T("TotalGroup"), _T("\x43\x1ED9ng kho\x61"));
		for(int i = 8; i < 12; i++)
		{
			FormatCurrency(nGroupTotal[i], tmpStr);
			szTemp.Format(_T("s%d"), i);
			rptDetail->SetValue(szTemp, tmpStr);
			nTotal[i] += nGroupTotal[i];
			nGroupTotal[i] = 0;
		}
	}

	if (nTotal[9] > 0)
	{
		for(int i = 8; i < 12; i++)
		{
			FormatCurrency(nTotal[i], tmpStr);
			szTemp.Format(_T("ss%d"), i);
			rpt.GetReportFooter()->SetValue(szTemp, tmpStr);
		}
	}

	CString szMoney;
	FormatCurrency(nTotal[9], szMoney);
	rpt.GetReportFooter()->SetValue(_T("Total"), szMoney);
	szMoney.Replace(_T("."), _T(""));
	MoneyToString(szMoney, szTemp);
	rpt.GetReportFooter()->SetValue(_T("SumInWords"), szTemp + _T(" \x111\x1ED3ng"));

	szSysDate = pMF->GetSysDate();
	tmpStr.Format(rpt.GetReportFooter()->GetValue(_T("PrintDate")),
		          szSysDate.Right(2), szSysDate.Mid(5, 2), szSysDate.Left(4));
	rpt.GetReportFooter()->SetValue(_T("PrintDate"), tmpStr);

	EndWaitCursor();
	rpt.PrintPreview();
} 
示例#16
0
//叫分按钮
void CGameClientView::OnThreeScore()
{
	AfxGetMainWnd()->SendMessage(IDM_LAND_SCORE,3,3);
	return;
}
void CFMDischargedPaidPatientListByDay::OnExportSelect()
{
	CHMSMainFrame *pMF = (CHMSMainFrame*) AfxGetMainWnd();
	CRecord rs(&pMF->m_db);
	CString szSQL;
	CString tmpStr, szTemp;

	UpdateData(TRUE);
	BeginWaitCursor();

	szSQL = GetQueryString();
	rs.ExecSQL(szSQL);
	if (rs.IsEOF())
	{
		ShowMessageBox(_T("No Data"), MB_ICONERROR | MB_OK);
		return;
	}

	CExcel xls;
	xls.CreateSheet(1);
	xls.SetWorksheet(0);

	xls.SetColumnWidth(0, 5);
	xls.SetColumnWidth(1, 18);
	xls.SetColumnWidth(2, 7);
	xls.SetColumnWidth(3, 20);
	xls.SetColumnWidth(4, 11);
	xls.SetColumnWidth(5, 11);
	xls.SetColumnWidth(6, 11);
	xls.SetColumnWidth(7, 11);
	xls.SetColumnWidth(8, 11);
	xls.SetColumnWidth(9, 11);

	int nRow = 1;
	int nCol = 0;

	xls.SetRowHeight(6, 45);

	xls.SetCellMergedColumns(0, 1, 4);
	xls.SetCellMergedColumns(0, 2, 4);

	xls.SetCellMergedColumns(6, 1, 4);
	xls.SetCellMergedColumns(6, 2, 4);

	xls.SetCellText(0, 1, pMF->m_CompanyInfo.sc_pname, FMT_TEXT | FMT_CENTER, true);
	xls.SetCellText(0, 2, pMF->m_CompanyInfo.sc_name, FMT_TEXT | FMT_CENTER, true);

	xls.SetCellText(6, 1, _T("\x43\x1ED8NG H\xD2\x41 \x58\xC3 H\x1ED8I \x43H\x1EE6 NGH\x128\x41 VI\x1EC6T N\x41M"), FMT_TEXT | FMT_CENTER, true);
	xls.SetCellText(6, 2, _T("\x110\x1ED8\x43 L\x1EACP - T\x1EF0 \x44O - H\x1EA0NH PH\xDA\x43"), FMT_TEXT | FMT_CENTER, true);

	xls.SetCellMergedColumns(nCol, nRow + 3, 10);
	xls.SetCellMergedColumns(nCol, nRow + 4, 10);

	xls.SetCellText(nCol, nRow + 3, _T("\x44\x41NH S\xC1\x43H \x42\x1EC6NH NH\xC2N T\x1EA0M G\x1EECI \x110\xC3 R\x41 VI\x1EC6N \x43H\x1AF\x41 TH\x41NH TO\xC1N"),
					FMT_TEXT | FMT_CENTER, true, 16, 0);

	tmpStr.Format(_T("T\x1EEB ng\xE0y %s \x111\x1EBFn ng\xE0y %s"),
		          CDateTime::Convert(m_szFromDate, yyyymmdd | hhmm, ddmmyyyy | hhmm),
				  CDateTime::Convert(m_szToDate, yyyymmdd | hhmm, ddmmyyyy | hhmm));
	xls.SetCellText(nCol, nRow + 4, tmpStr, FMT_TEXT | FMT_CENTER, true, 12, 0);

	TranslateString(_T("Index"), tmpStr);
	xls.SetCellText(nCol, nRow + 5, tmpStr, FMT_TEXT | FMT_CENTER | FMT_VCENTER | FMT_WRAPING, true, 11);

	TranslateString(_T("Patient Name"), tmpStr);
	xls.SetCellText(nCol + 1, nRow + 5, tmpStr, FMT_TEXT | FMT_CENTER | FMT_VCENTER | FMT_WRAPING, true, 11);

	TranslateString(_T("Document No"), tmpStr);
	xls.SetCellText(nCol + 2, nRow + 5, tmpStr, FMT_TEXT | FMT_CENTER | FMT_VCENTER | FMT_WRAPING, true, 11);

	TranslateString(_T("Admission No"), tmpStr);
	xls.SetCellText(nCol + 3, nRow + 5, tmpStr, FMT_TEXT | FMT_CENTER | FMT_VCENTER | FMT_WRAPING, true, 11);

	TranslateString(_T("Dept"), tmpStr);
	xls.SetCellText(nCol + 4, nRow + 5, tmpStr, FMT_TEXT | FMT_CENTER | FMT_VCENTER | FMT_WRAPING, true, 11);

	xls.SetCellText(nCol + 5, nRow + 5, _T("Ti\x1EC1n t\x1EA1m g\x1EEDi"), FMT_TEXT | FMT_CENTER | FMT_VCENTER | FMT_WRAPING, true, 11);

	TranslateString(_T("Total Policy"), tmpStr);
	xls.SetCellText(nCol + 6, nRow + 5, tmpStr, FMT_TEXT | FMT_CENTER | FMT_VCENTER | FMT_WRAPING, true, 11);

	xls.SetCellText(nCol + 7, nRow + 5, _T("Ti\x1EC1n \x63hi ph\xED \x111\x1B0\x1EE3\x63 gi\x1EA3m"), FMT_TEXT | FMT_CENTER | FMT_VCENTER | FMT_WRAPING, true, 11);

	TranslateString(_T("Hospital Fee"), tmpStr);
	xls.SetCellText(nCol + 8, nRow + 5, tmpStr, FMT_TEXT | FMT_CENTER | FMT_VCENTER | FMT_WRAPING, true, 11);

	xls.SetCellText(nCol + 9, nRow + 5, _T("Thu"), FMT_TEXT | FMT_CENTER | FMT_VCENTER | FMT_WRAPING, true, 11);

	xls.SetCellText(nCol + 10, nRow + 5, _T("\x43hi"), FMT_TEXT | FMT_CENTER | FMT_VCENTER | FMT_WRAPING, true, 11);

	int nIndex = 1;
	nRow = 7;
	CString szOldLine, szNewLine;
	long double nGroupTotal[10];
	long double nTotal[10];
	double nCost;
	for(int i = 0; i < 10; i++)
	{
		nGroupTotal[i] = 0;
		nTotal[i] = 0;
	}
	while (!rs.IsEOF())
	{

		tmpStr.Format(_T("%d"), nIndex++);
		xls.SetCellText(nCol, nRow, tmpStr, FMT_INTEGER | FMT_WRAPING);

		rs.GetValue(_T("pname"), tmpStr);
		xls.SetCellText(nCol + 1, nRow, tmpStr, FMT_TEXT | FMT_WRAPING);

		rs.GetValue(_T("docno"), tmpStr);
		xls.SetCellText(nCol + 2, nRow, tmpStr, FMT_TEXT | FMT_WRAPING);

		rs.GetValue(_T("recordno"), tmpStr);
		xls.SetCellText(nCol + 3, nRow, tmpStr, FMT_TEXT | FMT_WRAPING);

		rs.GetValue(_T("deptid"), tmpStr);
		xls.SetCellText(nCol + 4, nRow, tmpStr, FMT_TEXT | FMT_WRAPING);

		rs.GetValue(_T("deposit"), nCost);
		nGroupTotal[4] += nCost;
		tmpStr.Format(_T("%.2f"), nCost);
		xls.SetCellText(nCol + 5, nRow, tmpStr, FMT_NUMBER1 | FMT_WRAPING);

		rs.GetValue(_T("chedo"), nCost);
		nGroupTotal[5] += nCost;
		tmpStr.Format(_T("%.2f"), nCost);
		xls.SetCellText(nCol + 6, nRow, tmpStr, FMT_NUMBER1 | FMT_WRAPING);

		rs.GetValue(_T("miengiam"), nCost);
		nGroupTotal[6] += nCost;
		tmpStr.Format(_T("%.2f"), nCost);
		xls.SetCellText(nCol + 7, nRow, tmpStr, FMT_NUMBER1 | FMT_WRAPING);

		rs.GetValue(_T("feeamt"), nCost);
		nGroupTotal[7] += nCost;
		tmpStr.Format(_T("%.2f"), nCost);
		xls.SetCellText(nCol + 8, nRow, tmpStr, FMT_NUMBER1 | FMT_WRAPING);

		rs.GetValue(_T("income"), nCost);
		nGroupTotal[8] += nCost;
		tmpStr.Format(_T("%.2f"), nCost);
		xls.SetCellText(nCol + 9, nRow, tmpStr, FMT_NUMBER1 | FMT_WRAPING);

		rs.GetValue(_T("outlay"), nCost);
		nGroupTotal[9] += nCost;
		tmpStr.Format(_T("%.2f"), nCost);
		xls.SetCellText(nCol + 10, nRow, tmpStr, FMT_NUMBER1 | FMT_WRAPING);

		rs.MoveNext();
		nRow++;
	}

	EndWaitCursor();
	xls.Save(_T("Exports\\DanhSachBenhRaVaoVien.xls"));
} 
示例#18
0
/*
BOOL CPlayerSeekBar::OnTtnNeedText(UINT id, NMHDR *pNMHDR, LRESULT *pResult)
{
	//AfxMessageBox(_T("x")); //where is my tooltip!?!
	UNREFERENCED_PARAMETER(id);

	TOOLTIPTEXT *pTTT = (TOOLTIPTEXT *)pNMHDR;
	UINT_PTR nID = pNMHDR->idFrom;
	BOOL bRet = FALSE;
	
	if(nID == 0){
		CString toolTip;
		CPoint point;
		GetCursorPos(&point);
		ScreenToClient(&point);
		CRect r = GetChannelRect();

		if(r.left <= r.right){

			__int64 mPos = 0;
			if(point.x < r.left) mPos = m_start;
			else if(point.x >= r.right) mPos = m_stop;
			else
			{
				__int64 w = r.right - r.left;
				if(m_start < m_stop)
					mPos = (m_start + ((m_stop - m_start) * (point.x - r.left) + (w/2)) / w);
			}
			DVD_HMSF_TIMECODE tcNow = RT2HMSF(mPos);
			
			if( tcNow.bHours > 0)
				toolTip.Format(_T("%02d:%02d:%02d"), tcNow.bHours, tcNow.bMinutes, tcNow.bSeconds);
			else 
				toolTip.Format(_T("%02d:%02d"), tcNow.bMinutes, tcNow.bSeconds);

			
			//AfxMessageBox(toolTip);
			//if(toolTip.IsEmpty())
			//	toolTip = _T("Unkown");

			if(!toolTip.IsEmpty()){
				pTTT->lpszText = toolTip.GetBuffer();
				pTTT->hinst = AfxGetResourceHandle();
				bRet = TRUE;
				
			}
		}
	}

	*pResult = 0;

	return bRet;
}*/
void CPlayerSeekBar::OnPaint()
{
	CPaintDC dc(this); // device context for painting

	bool fEnabled = m_fEnabled && m_start < m_stop;

	AppSettings& s = AfxGetAppSettings();

	COLORREF 
//		white = s.GetColorFromTheme(_T("SeekBarPlayed"), NEWUI_COLOR_SEEKBAR_PLAYED),
//		shadow = s.GetColorFromTheme(_T("SeekBarBottomBorderBG"), NEWUI_COLOR_BG), 
//		light = s.GetColorFromTheme(_T("SeekBarPlayed"), NEWUI_COLOR_BG), 
		bkg = s.GetColorFromTheme(_T("SeekBarBG"), NEWUI_COLOR_TOOLBAR_UPPERBG);

	CBrush bBkg(bkg);
	/*/ thumb
	if(0){
		CRect r = GetThumbRect(), r2 = GetInnerThumbRect();
		CRect rt = r, rit = r2;

		dc.Draw3dRect(&r, light, 0);
		r.DeflateRect(0, 0, 1, 1);
		dc.Draw3dRect(&r, light, shadow);
		r.DeflateRect(1, 1, 1, 1);

		CBrush b(bkg);

		dc.FrameRect(&r, &b);
		r.DeflateRect(0, 1, 0, 1);
		dc.FrameRect(&r, &b);

		r.DeflateRect(1, 1, 0, 0);
		dc.Draw3dRect(&r, shadow, bkg);

		if(fEnabled)
		{
			r.DeflateRect(1, 1, 1, 2);
			CPen white(PS_INSIDEFRAME, 1, white);
			CPen* old = dc.SelectObject(&white);
			dc.MoveTo(r.left, r.top);
			dc.LineTo(r.right, r.top);
			dc.MoveTo(r.left, r.bottom);
			dc.LineTo(r.right, r.bottom);
			dc.SelectObject(old);
			dc.SetPixel(r.CenterPoint().x, r.top, 0);
			dc.SetPixel(r.CenterPoint().x, r.bottom, 0);
		}

		dc.SetPixel(r.CenterPoint().x+5, r.top-4, bkg);

		{
			CRgn rgn1, rgn2;
			rgn1.CreateRectRgnIndirect(&rt);
			rgn2.CreateRectRgnIndirect(&rit);
			ExtSelectClipRgn(dc, rgn1, RGN_DIFF);
			ExtSelectClipRgn(dc, rgn2, RGN_OR);
		}
	}
*/
	// channel
	{
		CRect r = GetChannelRect();

		int cur = r.left + (int)((m_start < m_stop /*&& fEnabled*/) ? (__int64)r.Width() * (m_pos - m_start) / (m_stop - m_start) : 0);
		
#define CORBARS 10
		COLORREF havntplayed = s.GetColorFromTheme(_T("SeekBarUnPlayed"), 0x00434343);
		COLORREF Bars[CORBARS] = {s.GetColorFromTheme(_T("SeekBarPlayed1"), 0x000f412d), 
			s.GetColorFromTheme(_T("SeekBarPlayed2"), 0x0083ffdf), 
			s.GetColorFromTheme(_T("SeekBarPlayed3"), 0x0071fdd4), 
			s.GetColorFromTheme(_T("SeekBarPlayed4"), 0x0061f9c6),
      s.GetColorFromTheme(_T("SeekBarPlayed5"), 0x0061f9c6),
      s.GetColorFromTheme(_T("SeekBarPlayed6"), 0x0061f9c6),
			s.GetColorFromTheme(_T("SeekBarPlayed7"), 0x005ff5ba),
			s.GetColorFromTheme(_T("SeekBarPlayed8"), 0x0064f1b2),
			s.GetColorFromTheme(_T("SeekBarPlayed9"), 0x006fefb0),
			s.GetColorFromTheme(_T("SeekBarPlayed10"), 0x000f412d)};

		{
			CPen line(PS_INSIDEFRAME, 1, bkg);
			CPen* old = dc.SelectObject(&line);
			dc.MoveTo( cur , r.top );
			dc.LineTo( r.right, r.top );
			dc.MoveTo( cur , r.top + CORBARS - 1);
			dc.LineTo( r.right, r.top + CORBARS - 1);
		}
		CRect rFilled(r);
		rFilled.left =   cur;
		rFilled.top++;
		rFilled.bottom--;
		dc.FillSolidRect(&rFilled,  havntplayed ); //fEnabled ?
		
		//r = GetChannelRect();
		for(int i = 0; i < CORBARS ; i++){
			CPen line(PS_INSIDEFRAME, 1, Bars[i]);
			CPen* old = dc.SelectObject(&line);
			dc.MoveTo( r.left , r.top + i);
			dc.LineTo( cur, r.top + i);
		}

		{
			COLORREF P2 = s.GetColorFromTheme(_T("SeekBarBorder1"), 0x000d3324);
			COLORREF P1 = s.GetColorFromTheme(_T("SeekBarBorder2"),0x00091611);
			dc.SetPixel(r.left-1, r.top+1, P2);
			dc.SetPixel(r.left, r.top, P2);
			dc.SetPixel(r.left-1, r.bottom-2, P2);
			dc.SetPixel(r.left, r.bottom-1, P2);
			dc.SetPixel(cur+1, r.top+1, P2);
			dc.SetPixel(cur, r.top, P2);
			dc.SetPixel(cur+1, r.bottom-2, P2);
			dc.SetPixel(cur, r.bottom-1, P2);
			dc.SetPixel(cur+1, r.top, P1);
			dc.SetPixel(cur+1, r.bottom-1, P1);
			dc.SetPixel(r.left-1, r.top, P1);
			dc.SetPixel(r.left-1, r.bottom-1, P1);

			CPen line(PS_INSIDEFRAME, 1, Bars[0]);
			CPen* old = dc.SelectObject(&line);

			dc.MoveTo( r.left-1 , r.top + 2);
			dc.LineTo( r.left-1 , r.bottom-2);
			dc.MoveTo( cur+1 , r.top + 2);
			dc.LineTo( cur+1 , r.bottom-2);
		}

		CMainFrame* pFrame = (CMainFrame*)AfxGetMainWnd();
		if( pFrame->m_aRefTime > 0){
			CRect rFilled(r);
			
			rFilled.left += (__int64)r.Width() * (pFrame->m_aRefTime - m_start) / (m_stop - m_start) ;
			if( pFrame->m_aRefTime < pFrame->m_bRefTime )
				rFilled.right = r.left + (__int64)r.Width() * (pFrame->m_bRefTime - m_start) / (m_stop - m_start) ;
			else
				rFilled.right = rFilled.left + 1;

			rFilled.top+=2;
			rFilled.bottom-=2;

			CBrush nBrush(HS_DIAGCROSS,  s.GetColorFromTheme(_T("SeekBarABArea"), 0x003fff9a ));
			dc.FillRect(&rFilled,&nBrush ); //fEnabled ?
		}
		
		/*
		switch( cur % 4 ){
					case 3:
						cur--;
						break;
					case 2:
						cur+=2;
						break;
					case 1:
						cur++;
						break;
				}
				for(int drawPos = cur ; drawPos < r.right; drawPos +=2){
					CRect step(drawPos,r.top, drawPos+2, r.bottom);
					if(drawPos % 4){
						dc.FillSolidRect( &step, NEWUI_COLOR_TOOLBAR_UPPERBG);
					}else{
						dc.FillSolidRect( &step, white);
					}
				}*/
		
		//r.InflateRect(1, 1);
		//dc.Draw3dRect(&r, shadow, light);
		dc.ExcludeClipRect(&r);
	}

	// background
	{
		CRect r;
		GetClientRect(&r);
		dc.FillRect(&r, &bBkg);
	}


	// Do not call CDialogBar::OnPaint() for painting messages
}
int CFMDischargedPaidPatientListByDay::OnDeptListDeleteItem(){
	CHMSMainFrame *pMF = (CHMSMainFrame*) AfxGetMainWnd();
	 return 0;
} 
示例#20
0
void CPlayerSeekBar::SetTimecodeTip(){
	CString toolTip;
	CPoint point , screenPos;
	GetCursorPos(&point);
	screenPos = point;
	ScreenToClient(&point);
	CRect rcClient;
	if( !rcClient.PtInRect(point)){

		//return;
	}
	CRect r = GetChannelRect();

	if(r.left <= r.right){

		__int64 mPos = 0;
		if(point.x < r.left) mPos = m_start;
		else if(point.x >= r.right) mPos = m_stop;
		else
		{
			__int64 w = r.right - r.left;
			if(m_start < m_stop)
				mPos = (m_start + ((m_stop - m_start) * (point.x - r.left) + (w/2)) / w);
		}
		DVD_HMSF_TIMECODE tcNow = RT2HMSF(mPos);

		if( tcNow.bHours > 0)
			toolTip.Format(_T("%02d:%02d:%02d"), tcNow.bHours, tcNow.bMinutes, tcNow.bSeconds);
		else 
			toolTip.Format(_T("%02d:%02d"), tcNow.bMinutes, tcNow.bSeconds);


		//AfxMessageBox(toolTip);
		//if(toolTip.IsEmpty())
		//	toolTip = _T("Unkown");

		if(!toolTip.IsEmpty()){
			CMainFrame* pFrame = (CMainFrame*)AfxGetMainWnd();
			pFrame->m_tip.m_text = toolTip;
			CSize tipsize = pFrame->m_tip.CountSize();
			point = screenPos;
			CRect rcTip ( point.x - tipsize.cx/2 , point.y - tipsize.cy - 6,point.x + tipsize.cx/2 , point.y -  6);
			//SVP_LogMsg5(_T("Tip %d %d %d %d") , rcTip.left,rcTip.top , rcTip.right,rcTip.left);

			HMONITOR hMonitor = MonitorFromWindow(m_hWnd, MONITOR_DEFAULTTONEAREST);

			MONITORINFO mi;
			mi.cbSize = sizeof(MONITORINFO);
			GetMonitorInfo(hMonitor, &mi);

			if(rcTip.left < mi.rcWork.left){
				rcTip.MoveToX(mi.rcWork.left + 3);
			}else if(rcTip.right > mi.rcWork.right){
				rcTip.MoveToX(mi.rcWork.right - rcTip.Width() - 3);
			}

			pFrame->m_tip.MoveWindow( rcTip );
			pFrame->m_tip.ShowWindow(SW_SHOWNOACTIVATE);
			pFrame->m_tip.Invalidate();
		}
	}
}
示例#21
0
void CUserListCtrl::OnContextMenu(CWnd* pWnd, CPoint point) 
{
	//		make sure window is active
	//
	GetParentFrame()->ActivateFrame();


	///////////////////////////////
	// See ContextMenuRules.txt for order of menu commands!

	//		create an empty context menu
	//
	CP4Menu popMenu;
    popMenu.LoadMenu(IDR_USER);

	int	index;
    SetIndexAndPoint( index, point );

	if( index != -1 )
	{
		// Can only edit or delete my user
		if ( GetSelectedItemText( ) == GET_P4REGPTR( )->GetP4User( ) )
		{
            // can't switch if already there
            popMenu.GetSubMenu(0)->DeleteMenu(ID_USER_SWITCHTOUSER,MF_BYCOMMAND);
        }
        else
        {
            // can't edit, delete, set password or set as default if not current
            popMenu.GetSubMenu(0)->DeleteMenu(ID_USER_EDITMY,MF_BYCOMMAND);
            popMenu.GetSubMenu(0)->DeleteMenu(ID_USER_DELETE,MF_BYCOMMAND);
            popMenu.GetSubMenu(0)->DeleteMenu(ID_USER_PASSWORD,MF_BYCOMMAND);
            popMenu.GetSubMenu(0)->DeleteMenu(ID_SETDEFUSER,MF_BYCOMMAND);
        }
	}
    else
    {
        // can't do much if no user selected
        popMenu.GetSubMenu(0)->DeleteMenu(ID_USER_EDITMY,MF_BYCOMMAND);
        popMenu.GetSubMenu(0)->DeleteMenu(ID_USER_DESCRIBE,MF_BYCOMMAND);
        popMenu.GetSubMenu(0)->DeleteMenu(ID_USER_DELETE,MF_BYCOMMAND);
        popMenu.GetSubMenu(0)->DeleteMenu(ID_USER_SWITCHTOUSER,MF_BYCOMMAND);
        popMenu.GetSubMenu(0)->DeleteMenu(ID_USER_PASSWORD,MF_BYCOMMAND);
        popMenu.GetSubMenu(0)->DeleteMenu(ID_SETDEFUSER,MF_BYCOMMAND);
        // clobber extra separator
        popMenu.GetSubMenu(0)->DeleteMenu(1,MF_BYPOSITION);

    }

	MainFrame()->AddToolsToContextMenu((CP4Menu *)(popMenu.GetSubMenu(0)));

	popMenu.GetSubMenu(0)->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON,	point.x, point.y, AfxGetMainWnd());
}
示例#22
0
bool MeaPositionLogMgr::Load(LPCTSTR pathname)
{
    // If there is a modified set of positions, ask the user if
    // they should be saved before loading a new set.
    //
    if (!SaveIfModified()) {
        return false;
    }

    if (pathname != NULL) {
        m_pathname = pathname;
    } else {
        CFileDialog *dlg = CreateLoadDialog();

        if (dlg->DoModal() != IDOK) {
            return false;
        }
        m_pathname = dlg->GetPathName();
    }

    bool status = false;
    TCHAR drive[_MAX_DRIVE];
    TCHAR dir[_MAX_DIR];

    //
    // Remember the directory for persisting.
    //
    _tsplitpath_s(m_pathname, drive, _MAX_DRIVE, dir, _MAX_DIR, NULL, 0, NULL, 0);
    m_initialDir = drive;
    m_initialDir += dir;

    //
    // Load the positions
    //
    if (Open(m_pathname, CFile::modeRead)) {
        //
        // Delete old positions.
        //
        ClearPositions();
    
        //
        // Parse the contents of the log file
        //
        MeaXMLParser parser(this, true);

        try {
            UINT numBytes;

            do {
                void *buf = parser.GetBuffer(kChunkSize);
                numBytes = m_stdioFile.Read(buf, kChunkSize);
                parser.ParseBuffer(numBytes, numBytes == 0);
            } while (numBytes > 0);

            status = true;
        } catch (MeaXMLParserException&) {
            // Handled by the parser.
        } catch (MeaLogFileException&) {
            CString msg(reinterpret_cast<LPCSTR>(IDS_MEA_INVALID_LOGFILE));
            MessageBox(*AfxGetMainWnd(), msg, NULL, MB_OK | MB_ICONERROR);
        } catch (...) {
            CString msg(reinterpret_cast<LPCSTR>(IDS_MEA_NO_POSITIONS));
            MessageBox(*AfxGetMainWnd(), msg, NULL, MB_OK | MB_ICONERROR);
        }

        Close();

        if (status) {
            //
            // Process the log file DOM
            //
            ProcessDOM(parser.GetDOM());

            m_modified = false;

            if (m_observer != NULL) {
                m_observer->LogLoaded();
            }
        }
    } else {
        m_pathname.Empty();
    }

    return status;
}
// Resize parent 
void CSplitterFrame::UpdateParent()
{
  CRect rcParent;
  CRect rcMainFrame;
  CRect rcMainClientFrame;
  CPoint pt = GetAbsPosition();
  CMainFrame* pMainFrame = STATIC_DOWNCAST(CMainFrame, AfxGetMainWnd());

  
  CDlgTemplate &wndParent = *(CDlgTemplate*)GetParent();
  pMainFrame->GetClientRect(&rcMainClientFrame);
  pMainFrame->GetWindowRect(&rcMainFrame);

  pt.x -=rcMainFrame.left;
  pt.y -=rcMainFrame.top;

  wndParent.GetWindowRect(&rcParent);
  wndParent.ShowWindow(SW_HIDE);


  INDEX iWidth = rcParent.right - rcParent.left;
  INDEX iHeight = rcParent.bottom - rcParent.top;

  if(sp_bDockingEnabled) {
    pMainFrame->FloatControlBar(&wndParent,CPoint(rcParent.left,rcParent.top));
    // is splitter attached on left side
    if(sp_uiDockSide == AFX_IDW_DOCKBAR_LEFT) {
      SET_BAR_SIZE(wndParent,rcMainClientFrame.right - pt.x,iHeight);
    // is splitter attached on right side
    } else if(sp_uiDockSide == AFX_IDW_DOCKBAR_RIGHT) {
      SET_BAR_SIZE(wndParent,pt.x,iHeight);
    // is splitter attached on top side
    } else if(sp_uiDockSide == AFX_IDW_DOCKBAR_TOP) {
      SET_BAR_SIZE(wndParent,iWidth,iHeight + sp_ptStartPoint.y - pt.y);
    // is splitter attached on bottom side
    } else if(sp_uiDockSide == AFX_IDW_DOCKBAR_BOTTOM) {
      ASSERT(FALSE);
    }

    // Chose docking side
    INDEX iDockSide = 0;
    // is splitter attached on left side
    if(sp_uiDockSide==AFX_IDW_DOCKBAR_LEFT) {
      iDockSide = AFX_IDW_DOCKBAR_RIGHT;
    // is splitter attached on right side
    } else if(sp_uiDockSide==AFX_IDW_DOCKBAR_RIGHT) {
      iDockSide = AFX_IDW_DOCKBAR_LEFT;
    // is splitter attached on top side
    } else if(sp_uiDockSide==AFX_IDW_DOCKBAR_TOP) {
      iDockSide = AFX_IDW_DOCKBAR_BOTTOM;
    // is splitter attached on bottom side
    } else if(sp_uiDockSide==AFX_IDW_DOCKBAR_BOTTOM) {
      iDockSide = AFX_IDW_DOCKBAR_TOP;
    }
    pMainFrame->DockControlBar(&wndParent,iDockSide);
  } else {
      SET_BAR_SIZE(wndParent,300,300);
    // wndParent.SetWindowPos(&wndBottom,0,0,100,300,SWP_NOZORDER);
    //pMainFrame->FloatControlBar(&wndParent,CPoint(rcParent.left,rcParent.top));
    //pMainFrame->DockControlBar(&wndParent,AFX_IDW_DOCKBAR_BOTTOM);
  }
  


  wndParent.ShowWindow(SW_SHOW);
  wndParent.UpdateWindow();
}
void CFMDischargedPaidPatientListByDay::OnSetWindowEvents()
{
	CHMSMainFrame *pMF = (CHMSMainFrame*) AfxGetMainWnd();
	//m_wndYear.SetEvent(WE_CHANGE, _OnYearChangeFnc);
	//m_wndYear.SetEvent(WE_SETFOCUS, _OnYearSetfocusFnc);
	//m_wndYear.SetEvent(WE_KILLFOCUS, _OnYearKillfocusFnc);
	m_wndYear.SetEvent(WE_CHECKVALUE, _OnYearCheckValueFnc);
	m_wndReportPeriod.SetEvent(WE_SELENDOK, _OnReportPeriodSelendokFnc);
	//m_wndReportPeriod.SetEvent(WE_SETFOCUS, _OnReportPeriodSetfocusFnc);
	//m_wndReportPeriod.SetEvent(WE_KILLFOCUS, _OnReportPeriodKillfocusFnc);
	m_wndReportPeriod.SetEvent(WE_SELCHANGE, _OnReportPeriodSelectChangeFnc);
	m_wndReportPeriod.SetEvent(WE_LOADDATA, _OnReportPeriodLoadDataFnc);
	//m_wndReportPeriod.SetEvent(WE_ADDNEW, _OnReportPeriodAddNewFnc);
	//m_wndFromDate.SetEvent(WE_CHANGE, _OnFromDateChangeFnc);
	//m_wndFromDate.SetEvent(WE_SETFOCUS, _OnFromDateSetfocusFnc);
	//m_wndFromDate.SetEvent(WE_KILLFOCUS, _OnFromDateKillfocusFnc);
	m_wndFromDate.SetEvent(WE_CHECKVALUE, _OnFromDateCheckValueFnc);
	//m_wndToDate.SetEvent(WE_CHANGE, _OnToDateChangeFnc);
	//m_wndToDate.SetEvent(WE_SETFOCUS, _OnToDateSetfocusFnc);
	//m_wndToDate.SetEvent(WE_KILLFOCUS, _OnToDateKillfocusFnc);
	m_wndToDate.SetEvent(WE_CHECKVALUE, _OnToDateCheckValueFnc);
	m_wndClerk.SetEvent(WE_SELENDOK, _OnClerkSelendokFnc);
	//m_wndClerk.SetEvent(WE_SETFOCUS, _OnClerkSetfocusFnc);
	//m_wndClerk.SetEvent(WE_KILLFOCUS, _OnClerkKillfocusFnc);
	m_wndClerk.SetEvent(WE_SELCHANGE, _OnClerkSelectChangeFnc);
	m_wndClerk.SetEvent(WE_LOADDATA, _OnClerkLoadDataFnc);
	//m_wndClerk.SetEvent(WE_ADDNEW, _OnClerkAddNewFnc);
	m_wndStaff.SetEvent(WE_SELENDOK, _OnStaffSelendokFnc);
	//m_wndStaff.SetEvent(WE_SETFOCUS, _OnStaffSetfocusFnc);
	//m_wndStaff.SetEvent(WE_KILLFOCUS, _OnStaffKillfocusFnc);
	m_wndStaff.SetEvent(WE_SELCHANGE, _OnStaffSelectChangeFnc);
	m_wndStaff.SetEvent(WE_LOADDATA, _OnStaffLoadDataFnc);
	//m_wndStaff.SetEvent(WE_ADDNEW, _OnStaffAddNewFnc);
	m_wndPrint.SetEvent(WE_CLICK, _OnPrintSelectFnc);
	m_wndExport.SetEvent(WE_CLICK, _OnExportSelectFnc);
	/*m_wndObjectList.SetEvent(WE_SELCHANGE, _OnObjectListSelectChangeFnc);
	m_wndObjectList.SetEvent(WE_LOADDATA, _OnObjectListLoadDataFnc);
	m_wndObjectList.SetEvent(WE_DBLCLICK, _OnObjectListDblClickFnc);*/

	/*m_wndObjectList.AddEvent(1, _T("Check All"), _OnObjectListCheckAllFnc);
	m_wndObjectList.AddEvent(2, _T("UnCheck All"), _OnObjectListUnCheckAllFnc);*/

	m_wndDeptList.SetEvent(WE_SELCHANGE, _OnDeptListSelectChangeFnc);
	m_wndDeptList.SetEvent(WE_LOADDATA, _OnDeptListLoadDataFnc);
	m_wndDeptList.SetEvent(WE_DBLCLICK, _OnDeptListDblClickFnc);

	m_wndDeptList.AddEvent(1, _T("Check All"), _OnDeptListCheckAllFnc);
	m_wndDeptList.AddEvent(2, _T("UnCheck All"), _OnDeptListUnCheckAllFnc);
	
	CString szSQL;
	CString szSysDate = pMF->GetSysDate();
	m_nYear = ToInt(szSysDate.Left(4));
	m_szReportPeriodKey.Format(_T("%d"), ToInt(szSysDate.Mid(5, 2)));
	m_szFromDate = m_szToDate = pMF->GetSysDate();
	m_szFromDate += _T("00:00");
	m_szToDate += _T("23:59");

	UpdateData(false);
//	OnObjectListLoadData();
	OnDeptListLoadData();

	/*CString tmpStr;
	for (int i = 0; i < m_wndObjectList.GetItemCount(); i++)
	{
		tmpStr = m_wndObjectList.GetItemText(i, 2);

		if (tmpStr == _T("S"))
			m_wndObjectList.SetCheck(i, TRUE);
	}*/
}
示例#25
0
void COpenScrapeView::OnDraw(CDC* pDC)
{
	COpenScrapeDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	if (!pDoc)
		return;

	CPen		*pTempPen, oldpen;
	CBrush		*pTempBrush, oldbrush;	
	HDC			hdc = *pDC;
	HDC			hdcScreen = CreateDC("DISPLAY", NULL, NULL, NULL); 
	HDC			hdcCompatible = CreateCompatibleDC(hdcScreen);
	HBITMAP		hbmp = CreateCompatibleBitmap(hdcScreen, 
										      pDoc->attached_rect.right - pDoc->attached_rect.left, 
										      pDoc->attached_rect.bottom - pDoc->attached_rect.top);
	HBITMAP		old_bitmap1, old_bitmap2;
	CMainFrame	*pmyframe = (CMainFrame*)AfxGetMainWnd(); 
	RECT		crect;

	// Draw attached window's bitmap as background
	if (pDoc->attached_bitmap)
	{
		old_bitmap1 = (HBITMAP) SelectObject(hdcCompatible, pDoc->attached_bitmap);
		old_bitmap2 = (HBITMAP) SelectObject(hdc, hbmp);
		BitBlt(hdc, 0, 0,
			   pDoc->attached_rect.right - pDoc->attached_rect.left,
			   pDoc->attached_rect.bottom - pDoc->attached_rect.top,
			   hdcCompatible, 0, 0, SRCCOPY);
		SelectObject(hdc, old_bitmap2);
		SelectObject(hdcCompatible, old_bitmap1);
	}
	else
	{
		pTempPen = (CPen*)pDC->SelectObject(null_pen);
		oldpen.FromHandle((HPEN)pTempPen);
		pTempBrush = (CBrush*)pDC->SelectObject(white_brush);
		oldbrush.FromHandle((HBRUSH)pTempBrush);

		GetClientRect(&crect);
		pDC->Rectangle(&crect);

		pDC->SelectObject(oldpen);
		pDC->SelectObject(oldbrush);
	}

	// Draw all region rectangles
	if (pmyframe->show_regions)
	{
		for (RMapCI r_iter=p_tablemap->r$()->begin(); r_iter!=p_tablemap->r$()->end(); r_iter++)
		{
			if ( (r_iter->second.name==dragged_region && dragging) || 
				 (r_iter->second.name==drawrect_region && drawing_rect && drawing_started) )
			{
				// Set pen and brush
				pTempPen = (CPen*)pDC->SelectObject(black_dot_pen);
				oldpen.FromHandle((HPEN)pTempPen);
				pTempBrush = (CBrush*)pDC->SelectObject(GetStockObject(NULL_BRUSH));
				oldbrush.FromHandle((HBRUSH)pTempBrush);

				pDC->Rectangle(r_iter->second.left-1, r_iter->second.top-1, r_iter->second.right+2, r_iter->second.bottom+2);

				pDC->SelectObject(oldpen);
				pDC->SelectObject(oldbrush);
			}

			else
			{
				// Set pen and brush
				pTempPen = (CPen*)pDC->SelectObject(red_pen);
				oldpen.FromHandle((HPEN)pTempPen);
				pTempBrush = (CBrush*)pDC->SelectObject(GetStockObject(NULL_BRUSH));
				oldbrush.FromHandle((HBRUSH)pTempBrush);

				pDC->Rectangle(r_iter->second.left-1, r_iter->second.top-1, r_iter->second.right+2, r_iter->second.bottom+2);

				pDC->SelectObject(oldpen);
				pDC->SelectObject(oldbrush);
			}
		}
	}

	// Clean Up
	DeleteObject(hbmp);
	DeleteDC(hdcCompatible);
	DeleteDC(hdcScreen);
}
void CFMDischargedPaidPatientListByDay::GetScreenToData(){
	CHMSMainFrame *pMF = (CHMSMainFrame*) AfxGetMainWnd();

}
示例#27
0
//游戏列表消息
bool CPlazaViewItem::OnSocketMainServerList(CMD_Command Command, void * pData, WORD wDataSize)
{
	ASSERT(Command.wMainCmdID==MDM_GP_SERVER_LIST);
	
	switch (Command.wSubCmdID)
	{
	case SUB_GP_LIST_TYPE:			//类型信息
		{
			//效验参数
			ASSERT(wDataSize%sizeof(tagGameType)==0);
			if (wDataSize%sizeof(tagGameType)!=0) return false;

			//处理消息
			tagGameType * pGameType=(tagGameType *)pData;
			WORD wItemCount=wDataSize/sizeof(tagGameType);
			g_GlobalUnits.m_ServerListManager.InsertTypeItem(pGameType,wItemCount);

			return true;
		}
	case SUB_GP_LIST_KIND:			//种类消息
		{
			//效验参数
			ASSERT(wDataSize%sizeof(tagGameKind)==0);
			if (wDataSize%sizeof(tagGameKind)!=0) return false;

			//处理消息
			tagGameKind * pGameKind=(tagGameKind *)pData;
			WORD wItemCount=wDataSize/sizeof(tagGameKind);
			g_GlobalUnits.m_ServerListManager.InsertKindItem(pGameKind,wItemCount);

			return true;
		}
	case SUB_GP_LIST_STATION:		//站点消息
		{
			//效验参数
			ASSERT(wDataSize%sizeof(tagGameStation)==0);
			if (wDataSize%sizeof(tagGameStation)!=0) return false;

			//处理消息
			tagGameStation * pGameStation=(tagGameStation *)pData;
			WORD wItemCount=wDataSize/sizeof(tagGameStation);
			g_GlobalUnits.m_ServerListManager.InsertStationItem(pGameStation,wItemCount);

			return true;
		}
	case SUB_GP_LIST_SERVER:		//服务器房间
		{
			//效验参数
			ASSERT(wDataSize%sizeof(tagGameServer)==0);
			if (wDataSize%sizeof(tagGameServer)!=0) return false;

			//处理消息
			tagGameServer * pGameServer=(tagGameServer *)pData;
			WORD wItemCount=wDataSize/sizeof(tagGameServer);
			g_GlobalUnits.m_ServerListManager.InsertServerItem(pGameServer,wItemCount);

			return true;
		}
	case SUB_GP_LIST_FINISH:		//列表发送完成
		{
			//更新人数
			INT_PTR nIndex=0;
			DWORD dwAllOnLineCount=0L;
			CListKind * pListKind=NULL;
			do
			{
				pListKind=g_GlobalUnits.m_ServerListManager.EnumKindItem(nIndex++);
				if (pListKind==NULL) break;
				dwAllOnLineCount+=pListKind->GetItemInfo()->dwOnLineCount;
			} while (true);
			g_GlobalUnits.m_ServerListManager.UpdateGameOnLineCount(dwAllOnLineCount);

			return true;
		}
	case SUB_GP_LIST_CONFIG:		//列表配置
		{
			//效验参数
			ASSERT(wDataSize%sizeof(CMD_GP_ListConfig)==0);
			if (wDataSize%sizeof(CMD_GP_ListConfig)!=0) return false;

			//处理消息
			CMD_GP_ListConfig * pListConfig=(CMD_GP_ListConfig *)pData;
			((CGameFrame*)AfxGetMainWnd())->m_ServerItemView.ShowOnLineCount(pListConfig->bShowOnLineCount?true:false);

			return true;
		}
	}

	return true;
}
void CFMDischargedPaidPatientListByDay::OnReportPeriodSelectChange(int nOldItemSel, int nNewItemSel){
	CHMSMainFrame *pMF = (CHMSMainFrame*) AfxGetMainWnd();
	
} 
示例#29
0
bool PT_Network::ReadGTFFiles(GDRect network_rect)  // Google Transit files
{

	//	// step 1: read  route files
	string str0 = m_ProjectDirectory +"routes.txt";
	//string str =  "h:/routes.csv";

	CT2CA pszConvertedAnsiString (str0.c_str());
	// construct a std::string using the LPCSTR input
	std::string  strStd (pszConvertedAnsiString);
	CCSVParser parser;

	if (parser.OpenCSVFile(strStd))
	{

		//	AfxMessageBox("Start reading Google Transit Feed files...", MB_ICONINFORMATION);

		int count =0;
		PT_Route route;
		while(parser.ReadRecord())
		{


			if(parser.GetValueByFieldName("route_id",route.route_id ) == false)
				break;
			if(parser.GetValueByFieldName("route_long_name",route.route_long_name) == false)
				route.route_long_name="";
			if(parser.GetValueByFieldName("route_short_name",route.route_short_name) == false)
				route.route_short_name="";			
			if(parser.GetValueByFieldName("route_url",route.route_url) == false)
				route.route_url="";			
			if(parser.GetValueByFieldName("route_type",route.route_type) == false)
				route.route_type="";		

			// make sure there is not duplicated key
			// If the requested key is not found, find() returns the end iterator for
			//the container, so:

			if(m_PT_RouteMap.find(route.route_id)  == m_PT_RouteMap.end() )
			{ 
				m_PT_RouteMap[route.route_id] = route;  
			}
			else
			{
				AfxMessageBox("Duplicated Route ID!");
			}


			count++;

		}
		parser.CloseCSVFile ();

		CMainFrame* pMainFrame = (CMainFrame*) AfxGetMainWnd();

		pMainFrame->m_bShowLayerMap[layer_transit] = true;

	}else
	{
		return false;
	}

	CString missing_stops_message;
	// step 1: read stop information
	string str2 = m_ProjectDirectory +"stops.txt";


	CT2CA pszConvertedAnsiString2 (str2.c_str());
	// construct a std::string using the LPCSTR input
	std::string  strStd2 (pszConvertedAnsiString2);
	if (parser.OpenCSVFile(strStd2))
	{
		int count =0;
		while(parser.ReadRecord())
		{
			PT_Stop stop;

			if(parser.GetValueByFieldName("stop_id",stop.stop_id ) == false)
				break;


			bool NonnegativeFlag = false;
			if(parser.GetValueByFieldName("stop_lat",stop.m_ShapePoint.y, NonnegativeFlag) == false)
				break;

			if(parser.GetValueByFieldName("stop_lon",stop.m_ShapePoint.x , NonnegativeFlag) == false)
				break;

			if(parser.GetValueByFieldName("direction",stop.direction  ) == false)
				stop.direction="";

			if(parser.GetValueByFieldName("location_type",stop.location_type) == false)
				stop.location_type=0;

			if(parser.GetValueByFieldName("position",stop.position  ) == false)
				stop.position="";

			if(parser.GetValueByFieldName("stop_code",stop.stop_code ) == false)
				stop.stop_code=0;

			parser.GetValueByFieldName("stop_desc",stop.stop_desc);


			if(parser.GetValueByFieldName("stop_name",stop.stop_name) == false)
				stop.stop_name="";

			if(parser.GetValueByFieldName("zone_id",stop.zone_id) == false)
				stop.zone_id=0;


			if(m_PT_StopMap.find(stop.stop_id) == m_PT_StopMap.end())
			{
				m_PT_StopMap[stop.stop_id] = stop;

			}else
			{   CString msg;
			msg.Format("Duplicated Stop ID %d", stop.stop_id);

			AfxMessageBox(msg);
			}

			count++;

		}
		parser.CloseCSVFile ();




	}


	//read trip file
	string str3 = m_ProjectDirectory +"trips.txt";
	CT2CA pszConvertedAnsiString3 (str3.c_str());
	// construct a std::string using the LPCSTR input
	std::string  strStd3 (pszConvertedAnsiString3);
	if (parser.OpenCSVFile(strStd3))
	{
		int count =0;
		while(parser.ReadRecord())
		{
			PT_Trip trip;

			if(parser.GetValueByFieldName("trip_id",trip.trip_id) == false)
				break;

			if(parser.GetValueByFieldName("route_id",trip.route_id) == false)
				break;			

			if(parser.GetValueByFieldName("service_id",trip.service_id) == false)
				break;			

			if(parser.GetValueByFieldName("block_id",trip.block_id) == false)
				trip.block_id=0;			

			if(parser.GetValueByFieldName("direction_id",trip.direction_id) == false)
				trip.direction_id=0;

			if(parser.GetValueByFieldName("shape_id",trip.shape_id) == false)
				trip.shape_id=0;

			if(parser.GetValueByFieldName("trip_type",trip.trip_type) == false)
				trip.trip_type=0;	 	

			if(m_PT_TripMap.find(trip.trip_id) == m_PT_TripMap.end())
			{
				m_PT_TripMap[trip.trip_id] = trip;
			}else
			{
				AfxMessageBox("Duplicated Trip ID!");
			}
			count++;
		}
		parser.CloseCSVFile ();
	}



	// read stop_times.txt
	int stop_times_count =0;
	int max_stop_times_record  = 1000;

	string str4 = m_ProjectDirectory +"stop_times.txt";
	CT2CA pszConvertedAnsiString4 (str4.c_str());
	// construct a std::string using the LPCSTR input
	std::string  strStd4 (pszConvertedAnsiString4);
	if (parser.OpenCSVFile(strStd4))
	{

		while(parser.ReadRecord())
		{
			PT_StopTime TransitStopTime;

			if(parser.GetValueByFieldName("stop_id",TransitStopTime.stop_id) == false)
				break;	

			string time_string;
			char char_array[20];
			if(parser.GetValueByFieldName("arrival_time",time_string) == false)
				break;

			int hour,min,second;
			sprintf(char_array,"%s",time_string.c_str ());
			sscanf(char_array,"%d:%d:%d", &hour,&min,&second);

			TransitStopTime.arrival_time = hour*60+min;

			if(parser.GetValueByFieldName("departure_time",time_string) == false)
				break;	

			sprintf(char_array,"%s",time_string.c_str ());
			sscanf(char_array,"%d:%d:%d", &hour,&min,&second);
			TransitStopTime.departure_time =  hour*60+min;

			if(parser.GetValueByFieldName("trip_id",TransitStopTime.trip_id) == false)
				break; 


			if(parser.GetValueByFieldName("stop_sequence",TransitStopTime.stop_sequence) == false)
				break; 			

			/*
			if(parser.GetValueByFieldName("drop_off_type",TransitStopTime.drop_off_type) == false)
			TransitStopTime.drop_off_type=0; 

			if(parser.GetValueByFieldName("pickup_type",TransitStopTime.pickup_type) == false)
			TransitStopTime.pickup_type=0;

			if(parser.GetValueByFieldName("shape_dist_traveled",TransitStopTime.shape_dist_traveled) == false)
			TransitStopTime.shape_dist_traveled=0;	

			if(parser.GetValueByFieldName("stop_headsign",TransitStopTime.stop_headsign) == false)
			TransitStopTime.stop_headsign=0;	

			if(parser.GetValueByFieldName("timepoint",TransitStopTime.timepoint) == false)
			TransitStopTime.timepoint=0;*/	

			if(m_PT_StopMap.find(TransitStopTime.stop_id)!= m_PT_StopMap.end())
			{
				TransitStopTime.pt.x = m_PT_StopMap[TransitStopTime.stop_id].m_ShapePoint .x ;
				TransitStopTime.pt.y = m_PT_StopMap[TransitStopTime.stop_id].m_ShapePoint .y ;

			}else
			{
				if(missing_stops_message.GetLength ()<1000)
				{
					CString msg;
					msg.Format ("Mising stop %d\n",TransitStopTime.stop_id);
					missing_stops_message+=msg;

				}

			}

		//	m_PT_StopTimeVector.push_back(TransitStopTime) ;
			stop_times_count++;

			//if(stop_times_count >=max_stop_times_record)  // for testing purposes
			//	break;

			if(m_PT_TripMap.find(TransitStopTime.trip_id) != m_PT_TripMap.end())
			{
				m_PT_TripMap[TransitStopTime.trip_id].m_PT_StopTimeVector .push_back(TransitStopTime);
			}

		}
		parser.CloseCSVFile ();

	}

	CString message;

	int trip_size = m_PT_TripMap.size();
	int stop_size = m_PT_StopMap.size();
	int stop_time_size = stop_times_count;
	message.Format("%d transit trips, %d stops and %d stop time records are loaded.", trip_size, stop_size, stop_time_size);

	AfxMessageBox(message, MB_ICONINFORMATION);

	if(missing_stops_message.GetLength ()>0)
	{
		AfxMessageBox(missing_stops_message);	
	}

	/*

	//read transfer file
	string str6 = m_ProjectDirectory +"transfers.txt";
	CT2CA pszConvertedAnsiString6 (str6.c_str());
	// construct a std::string using the LPCSTR input
	std::string  strStd6 (pszConvertedAnsiString6);
	if (parser.OpenCSVFile(strStd6))
	{
	int count =0;
	while(parser.ReadRecord())
	{
	PT_transfers transfers;

	if(parser.GetValueByFieldName("from_stop_id",transfers.from_stop_id) == false)
	break;	

	if(parser.GetValueByFieldName("to_stop_id",transfers.to_stop_id) == false)
	break; 			

	if(parser.GetValueByFieldName("transfer_type",transfers.transfer_type) == false)
	break;

	m_PT_transfers.push_back(transfers) ;
	count++;
	}
	parser.CloseCSVFile ();
	}

	*/

	// map matching



	return true;
}
示例#30
0
//叫分按钮
void CGameClientView::OnSnatchLand()
{
	AfxGetMainWnd()->SendMessage(IDM_LAND_SCORE,4,4);
	return;
}