ID #22923

VC++ 2008开发网络百家乐街机游戏(下)

  4.2.3  系统管理功能组

  系统管理功能组是后台服务端软件的核心部分,由【场局生成控制】、【游戏路单打印】、【历史营业记录】、【营业利润统计】及【营业日报打印】等几个模块组成。【场局生成控制】负责每场百家乐游戏的场局生成及开局操作;【游戏路单打印】在本场百家乐游戏开局后由游戏管理人员以密闭信封打印出来置于箱中,以便游戏结束后由玩家核对的确保游戏公平;其余三个模块是游戏运营的数据分析,可以根据运营商的需求以各种方式统计出游戏的运行效益。

  4.2.3.1  场局生成控制

  场局生成控制负责每一场百家乐游戏的路单生成,开局之后游戏根据此模块生成的路单运行每一局游戏,本游戏设计每场百家乐为一百八十局,因此做如下的界面设计:

VC++ 2008开发网络百家乐街机游戏(下)

  场局生成控制中关键是根据百家乐游戏的规则设计出发牌函数,由计算机模拟发牌由此生成本场百家乐的全部发牌记录表与庄闲记录表。根据百家乐游戏的规则,计算机模拟百家乐发牌由闲家开始,再发庄家,

  庄家与闲家各发两张牌后,分计出庄闲两家的牌点数再根据补牌规则表计算出第三张补牌,共模拟一百八十局场次,计算函数如下:

void CTH_ROUND_INIView::OnBnClickedScButton()
{
     // TODO: 在此添加控件通知处理程序代码
     ……
     //以循环方式发牌18行代表18轮
              for(int i=0;i<18;i++)
              {
                   CString* string_lpjl=new CString[10];
                   CString* string_fpjl=new CString[10];
     //每局发牌每轮10场
                   for(int j=0;j<10;j++)
                   {
                   //庄家变量
                       int int_bankerindex1,int_bankerindex2,int_bankerindex3;
                   //闲家变量
                       int int_playindex1,int_playindex2,int_playindex3;
                   //庄家与闲家点数
                       int int_banker_sumpoint,int_play_sumpoint;
                       CString string_banker_sumpoint,string_play_sumpoint;
                   //计算机模拟随机抽牌,按先闲家后庄家的规则顺序,庄闲各发两张牌
                       int_playindex1=rand()%52+1;
                       int_bankerindex1=rand()%52+1;
                       int_playindex2=rand()%52+1;
                       int_bankerindex2=rand()%52+1;
                   //计算出合计的点数
     int_banker_sumpoint=Return_resultpoint(Return_puckpoint(int_bankerindex1)+Return_puckpoint(int_bankerindex2));
     int_play_sumpoint=Return_resultpoint(Return_puckpoint(int_playindex1)+Return_puckpoint(int_playindex2));
//根据百家乐第三张牌的发牌规则表,计算第三张发牌
                       if(int_banker_sumpoint>=8||int_play_sumpoint>=8)
                       {
                   string_lpjl[j]=Return_ysstring(int_banker_sumpoint,int_play_sumpoint);
                   string_banker_sumpoint.Format("%d|%d",int_bankerindex1,int_bankerindex2);
                   string_play_sumpoint.Format("%d|%d",int_playindex1,int_playindex2);
                   string_fpjl[j]=string_banker_sumpoint+"="+string_play_sumpoint;
                       }
                       else
                       {
                            int_playindex3=rand()%52+1;
                            int_bankerindex3=rand()%52+1;
 
        , ;                    if(int_play_sumpoint==6||int_play_sumpoint==7)
                            {
                          , ;       if(int_banker_sumpoint<=5)
                                 {
int_banker_sumpoint=Return_resultpoint(int_banker_sumpoint+Return_puckpoint(int_bankerindex3));
string_lpjl[j]=Return_ysstring(int_banker_sumpoint,int_play_sumpoint);
string_banker_sumpoint.Format("%d|%d|%d",int_bankerindex1,int_bankerindex2,int_bankerindex3);
string_play_sumpoint.Format("%d|%d",int_playindex1,int_playindex2);
string_fpjl[j]=string_banker_sumpoint+"="+string_play_sumpoint;
                                 }
                                 else
                                 {
                  string_lpjl[j]=Return_ysstring(int_banker_sumpoint,int_play_sumpoint);
                   string_banker_sumpoint.Format("%d|%d",int_bankerindex1,int_bankerindex2);
                   string_play_sumpoint.Format("%d|%d",int_playindex1,int_playindex2);
                   string_fpjl[j]=string_banker_sumpoint+"="+string_play_sumpoint;
                                 }
                            }
                            else
                            {
                                 int int_play3=Return_puckpoint(int_playindex3);
                   int_play_sumpoint=Return_resultpoint(int_play_sumpoint+int_play3);
          if((int_banker_sumpoint==7)||(int_banker_sumpoint==6&&(int_play3==0||int_play3==1||int_play3==2||int_play3==3||int_play3==4||
int_play3==5||int_play3==8||int_play3==9))              ||(int_banker_sumpoint==5&&(int_play3==0||int_play3==1||int_play3==2||int_play3==3||int_play3==8||int_play3==9))
     ||(int_banker_sumpoint==4&&(int_play3==0||int_play3==1||int_play3==8||int_play3==9))
                                     ||(int_banker_sumpoint==3&&int_play3==8))
{
string_lpjl[j]=Return_ysstring(int_banker_sumpoint,int_play_sumpoint);
string_banker_sumpoint.Format("%d|%d",int_bankerindex1,int_bankerindex2);
string_play_sumpoint.Format("%d|%d|%d",int_playindex1,int_playindex2,int_playindex3);
string_fpjl[j]=string_banker_sumpoint+"="+string_play_sumpoint;
                                 }
                                 else
                                 {                                     int_banker_sumpoint=Return_resultpoint(int_banker_sumpoint+Return_puckpoint(int_bankerindex3));
     string_lpjl[j]=Return_ysstring(int_banker_sumpoint,int_play_sumpoint);
                                      string_banker_sumpoint.Format("%d|%d|%d",int_bankerindex1,int_bankerindex2,int_bankerindex3);
     string_play_sumpoint.Format("%d|%d|%d",int_playindex1,int_playindex2,int_playindex3);
string_fpjl[j]=string_banker_sumpoint+"="+string_play_sumpoint;
                                 }
                            }
                       }
                   }
//将记录载入百家乐路单记录表
                   CString sql_lpjl="insert into th_round_lpjl(A,B,C,D,E,F,G,H,I,J) values('";
                            sql_lpjl+=string_lpjl[0];
                            sql_lpjl+="','";
                            sql_lpjl+=string_lpjl[1];
                            sql_lpjl+="','";
                            sql_lpjl+=string_lpjl[2];
                            sql_lpjl+="','";
                            sql_lpjl+=string_lpjl[3];
                            sql_lpjl+="','";
                            sql_lpjl+=string_lpjl[4];
                            sql_lpjl+="','";
                            sql_lpjl+=string_lpjl[5];
                            sql_lpjl+="','";
                            sql_lpjl+=string_lpjl[6];
                            sql_lpjl+="','";
                            sql_lpjl+=string_lpjl[7];
                            sql_lpjl+="','";
                            sql_lpjl+=string_lpjl[8];
                            sql_lpjl+="','";
                            sql_lpjl+=string_lpjl[9];
                            sql_lpjl+="')";
                   m_datado.Exec(sql_lpjl);
//将记录载入百家乐发牌记录表(注:每场的发牌记录与路单记录是一一对应的)
                   CString sql_fpjl="insert into th_round_fpjl(A,B,C,D,E,F,G,H,I,J) values('";
                            sql_fpjl+=string_fpjl[0];
                            sql_fpjl+="','";
                            sql_fpjl+=string_fpjl[1];
                            sql_fpjl+="','";
                            sql_fpjl+=string_fpjl[2];
                            sql_fpjl+="','";
                            sql_fpjl+=string_fpjl[3];
                            sql_fpjl+="','";
                            sql_fpjl+=string_fpjl[4];
                            sql_fpjl+="','";
                            sql_fpjl+=string_fpjl[5];
                            sql_fpjl+="','";
                            sql_fpjl+=string_fpjl[6];
                            sql_fpjl+="','";
                            sql_fpjl+=string_fpjl[7];
                            sql_fpjl+="','";
                            sql_fpjl+=string_fpjl[8];
                            sql_fpjl+="','";
                            sql_fpjl+=string_fpjl[9];
                            sql_fpjl+="')";
                   m_datado.Exec(sql_fpjl);
                   delete [] string_fpjl;
                   delete [] string_lpjl;
              }
//数据库记录备份
              CString sql_bak="insert into th_round_lpjl_bak select * from th_round_lpjl";
              m_datado.Exec(sql_bak);
              m_datado.Close();
         }
         catch(...)
         {
              MessageBox("数据错误!");
         }
//刷新显示的记录表
         Update_data();
     }
     else
     {
         MessageBox("请清空场局后再随机生成!","提示",MB_ICONINFORMATION);
     }

  4.2.3.2  游戏路单打印

  根据百家乐游戏的规则,在游戏开始前须将生成好的每场游戏结果路单打印出来,锁入透明的玻璃箱中,以便玩家在游戏结束后能够核对该局游戏的结果,以示公平.因此软件设计【游戏路单打印】模块,操作人员在每场百家乐生成之后进入此模块打印游戏路单.首先使用aResReport VC++专用报表设计工具设计出百家乐路单,在开发环境中添加aResReport OCX ActiveX的控件支持,编码根据百家乐游戏路单记录表生成本场的百家乐数据报表,由操作人员打印出来.生成路单的函数如下:

void CTH_ROUND_CTLView::OnQdButton()
{
     // TODO: Add your control notification handler code here
     m_art.InitAresData();
     m_art.SetPrintOrientation(2);
     try
     {
         CDATABE_ADO m_datado;
         m_datado.Open("TH_ROUND","admin/admin","flyingtjf");
         m_datado.OpenTable("select * from th_round_lpjl");
         int count=m_datado.GetRecordCount();
         m_art.InsertRow("TAB",0,count);
         if(count>0)
         {
              m_datado.MoveFirst();
              //利用循环将数据载入报表文件
for(int i=0;i<count;i++)
              {
                   CString stra=m_datado.GetField("A");
                   m_art.SetVarData("A",i,stra);
                   CString strb=m_datado.GetField("B");
                   m_art.SetVarData("B",i,strb);
                   CString strc=m_datado.GetField("C");
                   m_art.SetVarData("C",i,strc);
                   CString strd=m_datado.GetField("D");
                   m_art.SetVarData("D",i,strd);
                   CString stre=m_datado.GetField("E");
                   m_art.SetVarData("E",i,stre);
                   CString strf=m_datado.GetField("F");
                   m_art.SetVarData("F",i,strf);
                   CString strg=m_datado.GetField("G");
                   m_art.SetVarData("G",i,strg);
                   CString strh=m_datado.GetField("H");
                   m_art.SetVarData("H",i,strh);
                   CString stri=m_datado.GetField("I");
                   m_art.SetVarData("I",i,stri);
                   CString strj=m_datado.GetField("J");
                   m_art.SetVarData("J",i,strj);
                   m_datado.MoveNext();
              }
              m_art.SetPrintOrientation(2);
              m_art.ReSetPageCount(1);
              m_art.SetCurPage(1);
              m_art.UpdateCurPageData();
         }
         m_datado.Close();
     }
     catch(...)
     {
     }
}

ÉÏÒ»Ò³ 1 2 3 4 5 6 7 8 9 10 ÏÂÒ»Ò³

¡¡¡¡ÔËÐнçÃæ½ØͼÈçÏÂ:

VC++ 2008¿ª·¢ÍøÂç°Ù¼ÒÀÖ½Ö»úÓÎÏ·£¨Ï£©

¡¡¡¡±¾Ä£¿é»¹Ìṩ½«ÓÎϷ·µ¥Êý¾Ýµ¼ÈëÎı¾Îļþ×öµç×Ó´æ´¢µÄ¹¦ÄÜ,º¯ÊýÈçÏÂ:

void CTH_ROUND_CTLView::OnBnClickedKlButton()
{
¡¡¡¡¡¡¡¡ // TODO: ÔÚ´ËÌí¼Ó¿Ø¼þ֪ͨ´¦Àí³ÌÐò´úÂë
¡¡¡¡¡¡¡¡ CFileDialog dlgFileOpen(FALSE);¡¡
¡¡¡¡¡¡¡¡ //¡¡¡¡ dlgFileOpen.m_ofn.lStructSize=structsize;
¡¡¡¡¡¡¡¡ dlgFileOpen.m_ofn.lpstrFilter = "Îı¾Îļþ*.TXTËùÓеÄÎļþ(*.*)*.*";
¡¡¡¡¡¡¡¡ //TCHAR¡¡¡¡ lpstrFilename[MAX_PATH] = "";
¡¡¡¡¡¡¡¡ dlgFileOpen.m_ofn.lpstrFile;//=lpstrFilename;
¡¡¡¡¡¡¡¡ dlgFileOpen.m_ofn.lStructSize=88;
¡¡¡¡¡¡¡¡ //±êÌâÀ¸
¡¡¡¡¡¡¡¡ dlgFileOpen.m_ofn.lpstrTitle="±£´æ¼Ç¼µ½Îļþ";
¡¡¡¡¡¡¡¡ //ÏÔʾÒÔ“Ö»¶Á·½Ê½´ò¿ª”
¡¡¡¡¡¡¡¡ dlgFileOpen.m_ofn.Flags&=~OFN_HIDEREADONLY;
¡¡¡¡¡¡¡¡ //ÏÔʾ“°ïÖú”,¶ÔÓ¦ÓÚµ±Ç°µÄHLPÎļþ
¡¡¡¡¡¡¡¡ ///dlgFileOpen.m_ofn.Flags|=OFN_ENABLETEMPLATEHANDLE;
¡¡¡¡¡¡¡¡ //dlgFileOpen.m_ofn.Flags|=OFN_EXPLORER|OFN_SHOWHELP;//|OFN_EXPLORER;
¡¡¡¡¡¡¡¡ //dlgFileOpen.m_ofn.lpTemplateName=MAKEINTRESOURCE(IDD_FILEOPENPREVEIW);
¡¡¡¡¡¡¡¡ if(dlgFileOpen.DoModal()==IDOK&&dlgFileOpen.GetPathName()!="")
¡¡¡¡¡¡¡¡ {
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ try
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ {
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ CDATABE_ADO m_datado;
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ m_datado.Open("TH_ROUND","admin/admin","flyingtjf");
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ m_datado.OpenTable("select * from th_round_lpjl");
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ int num=m_datado.GetRecordCount();
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ if(num>0)
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ {
//µ¼³ö±¨±íÎļþ¸ñʽÉèÖÃ
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ CString string_line_head="¡¡ LuckPoker Recorder¡¡¡¡¡¡¡¡ n";¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ string_line_head+="©°©¤©¤©Ð©¤©¤©¤©Ð©¤©¤©¤©Ð©¤©¤©¤©Ð©¤©¤©¤©Ð©¤©¤©¤©Ð©¤©¤©¤©Ð©¤©¤©¤©Ð©¤©¤©¤©Ð©¤©¤©¤©Ð©¤©¤©¤©´n";
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ string_line_head+="©¦¡¡¡¡ ©¦A¡¡¡¡¡¡¡¡ ©¦B¡¡¡¡¡¡¡¡ ©¦C¡¡¡¡¡¡¡¡ ©¦D¡¡¡¡¡¡¡¡ ©¦E¡¡¡¡¡¡¡¡ ©¦F¡¡¡¡¡¡¡¡ ©¦G¡¡¡¡¡¡¡¡ ©¦H¡¡¡¡¡¡¡¡ ©¦I¡¡¡¡¡¡¡¡ ©¦J¡¡¡¡¡¡¡¡ ©¦n";
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ CStdioFile lpjl_file;¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ lpjl_file.Open(dlgFileOpen.GetPathName(),CStdioFile::modeCreate|CStdioFile::modeWrite);
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ lpjl_file.WriteString(string_line_head);
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ m_datado.MoveFirst();
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ for(int i=0;i<num;i++)
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ {
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ CString string_head;
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ if(i<10)
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ string_head.Format("©¦%d¡¡ ©¦",i);
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ else
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ string_head.Format("©¦%d¡¡ ©¦",i);
¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ CString stra=m_datado.GetField("A");
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ CString strb=m_datado.GetField("B");
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ CString strc=m_datado.GetField("C");
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ CString strd=m_datado.GetField("D");
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ CString stre=m_datado.GetField("E");
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ CString strf=m_datado.GetField("F");
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ CString strg=m_datado.GetField("G");
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ CString strh=m_datado.GetField("H");
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ CString stri=m_datado.GetField("I");
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ CString strj=m_datado.GetField("J");
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ CString str1=Lpad_string(stra," ",6);
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ CString str2=Lpad_string(strb," ",6);
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ CString str3=Lpad_string(strc," ",6);
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ CString str4=Lpad_string(strd," ",6);
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ CString str5=Lpad_string(stre," ",6);
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ CString str6=Lpad_string(strf," ",6);
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ CString str7=Lpad_string(strg," ",6);
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ CString str8=Lpad_string(strh," ",6);
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ CString str9=Lpad_string(stri," ",6);
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ CString str10=Lpad_string(strj," ",6);
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ CString string_end;
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ string_end.Format("©¦n");
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ CString string_addline="©À©¤©¤©à©¤©¤©¤©à©¤©¤©¤©à©¤©¤©¤©à©¤©¤©¤©à©¤©¤©¤©à©¤©¤©¤©à©¤©¤©¤©à©¤©¤©¤©à©¤©¤©¤©à©¤©¤©¤©Èn";
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ string_addline+=string_head;
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ string_addline+=str1;
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ string_addline+="©¦";
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ string_addline+=str2;
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ string_addline+="©¦";
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ string_addline+=str3;
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ string_addline+="©¦";
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ string_addline+=str4;
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ string_addline+="©¦";
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ string_addline+=str5;
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ string_addline+="©¦";
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ string_addline+=str6;
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ string_addline+="©¦";
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ string_addline+=str7;
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ string_addline+="©¦";
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ string_addline+=str8;
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ string_addline+="©¦";
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ string_addline+=str9;
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ string_addline+="©¦";
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ string_addline+=str10;
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ string_addline+=string_end;
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ lpjl_file.WriteString(string_addline);
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ m_datado.MoveNext();
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ }
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ CString string_line_end="©¸©¤©¤©Ø©¤©¤©¤©Ø©¤©¤©¤©Ø©¤©¤©¤©Ø©¤©¤©¤©Ø©¤©¤©¤©Ø©¤©¤©¤©Ø©¤©¤©¤©Ø©¤©¤©¤©Ø©¤©¤©¤©Ø©¤©¤©¤©¼n";
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ lpjl_file.WriteString(string_line_end);
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ lpjl_file.Close();
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ }
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ m_datado.Close();
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ MessageBox("ÄãËù±£´æµÄÎļþÊÇ£º"+(CString)dlgFileOpen.m_ofn.lpstrFile,"Ìáʾ",MB_ICONINFORMATION);
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ }
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ catch(...)
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ {
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ }
¡¡¡¡¡¡¡¡ }
}

ÉÏһƪ£º ÉîÈëdz³öMFC¡°Îĵµ/ÊÓͼ¡±¼Ü¹¹£¨1£©¨D¨D»ù±¾¸ÅÄî
ÏÂһƪ£º ÉîÈëdz³öMFC¡°Îĵµ/ÊÓͼ¡±¼Ü¹¹£¨2£©¨D¨DÎĵµÄ£°å

ÉÏÒ»Ò³ 1 2 3 4 5 6 7 8 9 10 ÏÂÒ»Ò³

貧匯匈 1 2 3 4 5 6 7 8 9 10 和匯匈

  塰佩朔擬竃鯉塀舜夕泌和:

VC++ 2008蝕窟利大為社赤瞬字嗄老・和・

 參貧峪初府狼由砿尖孔嬬怏議曾倖宰伉庁翠,凪噫庁翠喇噐鐙嫌侭・音壅弩峰.

  4.3  嗄老扮嶝極譜柴

  嗄老扮嶝陣崙岬頁陣崙議屁倖為社赤嗄老尼唯塰佩議,荷恬繁埀宥狛嗄老扮嶝陣崙岬陣崙念岬人薩極嗄老議塰佩嚥壙唯,屁倖嗄老議蝕蕉嚥宜柴扮峻辛壓緩庁翠荷陣.

  4.3.1  罷周順中下崔

  嬉蝕Visual C++ 2008 IDE桟廠・仟秀參TH_ROUND_TIM凋兆議MFC Dialog垢殻圭宛・下崔Dialog順中議陣周泌和夕・

VC++ 2008蝕窟利大為社赤瞬字嗄老・和・

  4.3.2  庁翠園鷹

  功象乎錘為社赤瞬字嗄老議譜柴房・,嗄老扮嶝陣崙岬宥狛利大方象坿響函捲暦極議Access 2007方象垂,旺喇荷陣方象垂嶄議th_round_time揖化扮嶝芝村燕陣崙念岬人薩極議塰佩,咀緩寡喘協扮序殻議譜柴房・園亟乎庁翠議宰伉痕方,園鷹泌和:

void CTH_ROUND_TIMDlg::OnTimer(UINT nIDEvent)
{
     // TODO: Add your message handler code here and/or call default
     if(bool_end)
     {
         CString strdjs,strsubdjs;
         //響函嗄老譜崔議宜柴扮方峙
         labelccdjs:
         try
         {
              m_djs.GetWindowText(strdjs);
              strsubdjs.Format("%d",atoi(strdjs.operator LPCTSTR())-1);
              CDATABE_ADO m_ado;
              m_ado.Open("TH_ROUND","admin/admin","flyingtjf");
              m_ado.OpenTable("select * from th_round_time");
              m_ado.SetField("djs",strsubdjs);
              m_djs.SetWindowText(strsubdjs);
              m_ado.Close();
         }
         catch(...)
         {
              goto labelccdjs;
         }
         if(atoi(strsubdjs.operator LPCTSTR())==10&&string_gameregular=="BTOC")
         {
              //壓宜柴扮叱昼扮怦僅念極人薩字議匯俳貧蛍荷恬
              if(bool_sfcdpx)
              {
                   run_cdpx();
              }
              else
              {
                   if(bool_sfzdsc)
                   {
                       run_zdsf();
                   }
              }
         }
         //繍嗄老扮嶝陣崙岬崔噐吉棋彜蓑
         if(atoi(strsubdjs.operator LPCTSTR())==0)
         {
              labelstart:
              try
              {
                   CDATABE_ADO m_datado;
                   m_datado.Open("TH_ROUND","admin/admin","flyingtjf");
                   m_datado.OpenTable("select * from th_round_wait");
                   m_datado.SetField("reset","1");
                   m_datado.Close();
              }
              catch(...)
              {
                   goto labelstart;
              }
         //壓念岬人薩極嗄老塰佩窟兎強鮫扮揖化吉棋 
              Sleep(10000);
              CString bool_waitmac="1";
              do
              {
                   label:
                   try
                   {
                       CDATABE_ADO m_ado;
                       m_ado.Open("TH_ROUND","admin/admin","flyingtjf");
                        m_ado.OpenTable("select * from th_round_wait");
                       bool_waitmac=m_ado.GetField("waitmac");
                       m_ado.Close();
                   }
                   catch(...)
                   {
                       goto label;
                   }
              }
              while(bool_waitmac=="1");
              //和匯態嗄老宜柴扮蝕兵
              CString bufferdjs;
              {
                   label1:
                  try
                   {
                       CDATABE_ADO m_ado;
                       m_ado.Open("TH_ROUND","admin/admin","flyingtjf");
                       m_ado.OpenTable("select * from th_round_info");
                       bufferdjs=m_ado.GetField("宜柴扮");
                       string_gameregular=m_ado.GetField("嗄老号夸");
                       …
                       //響函譜崔議児粥方象
              }
              //魁肝柴方
              CString string_bjcc;
              m_bjcc.GetWindowText(string_bjcc);
              labelccjs:
              try
              {
                   CDATABE_ADO m_ado;
                   ……
                   m_datado.Close();
              }
              catch(...)
              {
                   goto labelend;
              }
              //180蕉嗄老塰佩頼穎朔,扮嶝陣崙岬徭強唯峭
              if(atoi(string_bjcc.operator LPCTSTR())>=179)
              {
                   KillTimer(1);
                   bool_end=false;
                   //悳蕉方柴方
                   …
                   MessageBox("云蕉魁肝厮潤崩!","戻幣");
              }
         }
     }
     CDialog::OnTimer(nIDEvent);
}

貧匯鐙・ 貫32了哘喘殻會欺64了哘喘殻會
和匯鐙・ VC嶄議TRACE崎

貧匯匈 1 2 3 4 5 6 7 8 9 10 和匯匈

  4.4  前台客户端设计

  前台客户端是整个百家乐游戏操作设计要求最高的一块,要考虑到街机的改装与移植,因此将PC机的整个键盘区域在软件中重新定义,以便能够支持十个玩家同时操作一台前端主机而不冲突,前台客户端采用一台主机通过分屏器连接十台显示器方式,由十个玩家分别操作各自的控制台按键上退分.

  4.4.1  软件界面设计

  因为前台客户端面向游戏玩家,设计界面尽量美观和谐,可操作性强,游戏的操作同时支持十个玩家,按键按小注,大注,取消,红庄,黑闲,绿和六个设计,发牌动画安排在屏幕的左上方.屏幕右上方安排百家乐游戏的整场路单结果,画面如下:

VC++ 2008开发网络百家乐街机游戏(下)

  打开Visual C++ 2008 IDE环境,新建以TH_ROUND_WIN命名的MFC Dialog工程方案,整个前台工程全部由编码完成,不涉及控件运用.

  4.4.2  模块编码

  前台客户端编码主要分三块,一是利用多线程技术同步读取游戏时钟控制台的时钟数据,二是对PC键盘进行十区域分割支持多个玩家同时操作,三是针对每场的百家乐游戏根据事先生成好的游戏路单结果逐场发牌并结合玩家的下分计算出玩家的输赢状况回馈显示,详细介绍如下:

  4.4.2.1  游戏同步时钟读取

  游戏同步时钟是后台控制前端游戏画面同步显示与数据运行速度的关键,根据系统的性能要求采用工作者线程技术读取后台的同步时钟数据,首先在TH_ROUND_WINDlg.h头文件中定义新的同步时钟读取消息,编码如下: #define WM_READTIMER WM_USER+1;

  再定义对应此消息的用户界面响应函数: LRESULT Read_timer(WPARAM wParam,LPARAM lParam);此函数是整个前端客户软件的核心所在,联系了后台的同步时钟与动画显示等一系列功能.再定义工作者线程变量: CWinThread* m_PDrawThread;

  准备工作就绪开始运用函数编码,利用工作者线程读取后台的同步时钟需利用全局函数做消息循环的响应控制,如下:

UINT Play_timer(LPVOID sound)
{
while(1)
     {
         AfxGetMainWnd()->PostMessageA(WM_READTIMER);
         Sleep(1000);
     }
     return 0;
}

  此函数利用无穷循环以秒级单位向用户界面不断发送读时钟的消息,与游戏时钟控制台保持同步显示.此函数的启动在工程的OnInitDialog()函数中编码完成,如下:

……
if(m_PDrawThread)
     {
         StopDraw=true;
         m_PDrawThread->ResumeThread();
         ::WaitForSingleObject(m_PDrawThread->m_hThread,INFINITE);
         delete m_PDrawThread;
     }
     m_PDrawThread=AfxBeginThread(Play_timer,&m_hWnd,THREAD_PRIORITY_ABOVE_NORMAL,0,CREATE_SUSPENDED);
     m_PDrawThread->m_bAutoDelete=false;
     StopDraw=false;
m_PDrawThread->ResumeThread();
……

  此处编码确保前台客户端游戏启动时能及时发送用户界面读时函数,与时钟控制台同步运行,用户界面读时函数的编码如下:

LRESULT CTH_ROUND_WINDlg::Read_timer(WPARAM wParam,LPARAM lParam)
{
     //初始化倒计时等一些基本参数
     ……
     if(int_djs<=11&&bool_hidesfyf)
     {
     //倒计时达11秒时开始隐藏上局游戏发牌,准备新局的发牌
         Hide_sf();
         Reset_winfz();
     //读取本局游戏路单记录,准备本局游戏发牌
         …
         Show_aviprev();
         string_bjlprec=Return_bjlprec();
         Return_bcfp();
         bool_hidesfyf=false;  
     }
     //倒计时达6秒,本局游戏开始发牌
     if(int_djs<=6&&bool_hide6)
     {
         Move_play1_prev();//闲家第一张牌
         bool_hide6=false;
     }
     if(int_djs<=5&&bool_hide5)
     {
         Move_banker1_prev();//庄家第一张牌
         bool_hide5=false;
     }
     if(int_djs<=4&&bool_hide4)
     {
         Move_play2_prev();//闲家第二张牌
         bool_hide4=false;
     }
     if(int_djs<=3&&bool_hide3)
     {
         Move_banker2_prev();//庄家第二张牌
         bool_hide3=false;
     }
     if(int_djs<=2&&bool_hide2)
     {
          Move_play3_prev();//闲家第三张牌,如有则显示,无则不显示
         bool_hide2=false;
     }
     if(int_djs<=1&&bool_hide1)
     {
         Move_banker3_prev();//庄家第三张牌,如有则显示,无则不显示
         bool_hide1=false;
     }
     if(int_djs==0)
   , ;  {
         m_PDrawThread->SuspendThread();//挂起读时工作者线程
//calculate
         ……
         CString retstravi=Add_bjlprec();//在游戏画面右上角的游戏路单记录中增加本局结果显示
         Calculate_grade(retstravi);//根据本局结果结合玩家的游戏下分计算各玩家的输赢状况
//end
         ……
         Move_end();
         m_PDrawThread->ResumeThread();//本局游戏结束,恢复读时线程
     }
     //游戏结束时判断开局
     m_sumcc.GetWindowText(string_bjcc);
     if(string_bjcc=="180")
     {
         Show_sumcc();
         if(bool_hylpjl)
         {
              bool_hylpjl=false;
              Hide_bjlprec();
              Show_bjlprec();
         }
     }
     //游戏开局后隐藏上一轮的游戏记录
     m_sumcc.GetWindowText(string_bjcc);
     if(string_bjcc=="0")
     {
         Hide_bjlprec();
         Reset_winfz();
     }
}

ÉÏÒ»Ò³ 1 2 3 4 5 6 7 8 9 10 ÏÂÒ»Ò³

¡¡¡¡Íæ¼ÒÊäÓ®·ÖÖµ¼ÆË㺯ÊýµÄºËÐıàÂë¾ÙÀýÈçÏÂ:

void CTH_ROUND_WINDlg::Calculate_grade_btoc(CString retstring)
{
¡¡¡¡¡¡¡¡ //¶ÁÈ¡ÅâÂʲÎÊý
¡¡¡¡¡¡¡¡ ……
¡¡¡¡¡¡¡¡ if(retstring=="ºìÉ«")
¡¡¡¡¡¡¡¡ {
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ for(int i=0;i<10;i++)
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ {
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ //Ñ­»·¼ÆËãÊ®¸öÍæ¼ÒµÄÊäÓ®·ÖÖµ²¢»ØÀ¡ÏÔʾ
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ CString string_monzsf,string_redmonyfz,string_blackmonyfz,string_greenmonyfz;
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ m_zsf[i].GetWindowText(string_monzsf);
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ m_red[i].GetWindowText(string_redmonyfz);
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ m_black[i].GetWindowText(string_blackmonyfz);
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ m_green[i].GetWindowText(string_greenmonyfz);
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ int int_zsf=atoi(string_monzsf.operator LPCTSTR());
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ int int_red=atoi(string_redmonyfz.operator LPCTSTR());
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ int int_black=atoi(string_blackmonyfz.operator LPCTSTR());
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ int int_green=atoi(string_greenmonyfz.operator LPCTSTR());
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ if(int_red>0)
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ {
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ int int_yf,int_addzsf;
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ if(string_csq=="red")
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ {
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ int_yf=(int)(floor(int_red*(int_redcomrate-1)*(1.00-double_csl)));
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ int_addzsf=int_yf+int_red;
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ }
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ else
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ {
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ int_yf=int_red*(int_redcomrate-1);
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ int_addzsf=int_yf+int_red;
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ }
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ int_zsf+=int_addzsf;
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ string_monzsf.Format("%d",int_zsf);
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ CString string_winfz;
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ if(int_addzsf-int_black-int_green>0)
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ string_winfz.Format("£«%d",int_addzsf-int_black-int_green);
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ if(int_addzsf-int_black-int_green<0)
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ string_winfz.Format("£­%d",abs(int_addzsf-int_black-int_green));
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ m_yf[i].SetText(string_winfz);
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ }
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ else
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ {
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ CString string_falfz;
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ string_falfz.Format("£­%d",int_black+int_green);
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ if(string_falfz!="£­")
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ m_yf[i].SetText(string_falfz);
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ }
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ //дÈëºǫ́Êý¾Ý¿âÖÐ
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ CString strsql;
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ if(i==0)
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ strsql="select * from th_round_single01";
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ ……
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ if(i==8)
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ strsql="select * from th_round_single09";
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ if(i==9)
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ strsql="select * from th_round_single10";
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ labelred:
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ try
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ {
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ CDATABE_ADO m_datado;
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ m_datado.Open("TH_ROUND","admin/admin","flyingtjf");
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ m_datado.OpenTable(strsql);
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ m_datado.SetField("single_ztf",string_monzsf);
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ m_datado.SetField("red","0");
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ m_datado.SetField("black","0");
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ m_datado.SetField("green","0");
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ m_zsf[i].SetWindowText(string_monzsf);
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ m_red[i].SetWindowText("0");
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ m_black[i].SetWindowText("0");
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ m_green[i].SetWindowText("0");
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ m_datado.Close();
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ }
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ catch(...)
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ {
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ goto labelred;
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ }
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ }
¡¡¡¡¡¡¡¡ }
¡¡¡¡¡¡¡¡ if(retstring=="ºÚÉ«")
¡¡¡¡¡¡¡¡ {
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ ……
¡¡¡¡¡¡¡¡ }
¡¡¡¡¡¡¡¡ if(retstring=="ÂÌÉ«")
¡¡¡¡¡¡¡¡ {
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ ……
¡¡¡¡¡¡¡¡ }
}

ÉÏһƪ£º ÓÃVC6ʵÏÖIE¹¤¾ßÀ¸
ÏÂһƪ£º ÈçºÎ½«²úÆ·ÖÆ×÷³ÉÌÔ±¦CSVÊý¾Ý°ü

ÉÏÒ»Ò³ 1 2 3 4 5 6 7 8 9 10 ÏÂÒ»Ò³

貧匯匈 1 2 3 4 5 6 7 8 9 10 和匯匈

  4.4.2.2  PC囚徒噴曝囃蛍護協吶

  云嗄老念極罷周寡喘匯岬PC麼字賜BOX庁亭匂宥狛蛍徳匂銭俊噴岬・幣匂議庁塀,罷周壓揖匯鮫中貧屶隔噴倖螺社揖扮荷恬,咀緩児噐PC字峠岬冩窟扮倬斤PC議炎彈囚徒序佩噴曝囃議皿蛍,芦廾扮寡喘廨喘議PC囚徒堪俊触銭俊欺光倖嗄老国議陣崙岬貧圭宴荷恬,深打囚徒窮揃議鹸喘怏栽彜趨,勣箔屶隔謹・殻議囚徒梓囚旺音嬬梓囚喝融孤氾,将狛斤囚徒窮揃議冩梢蛍裂,恬泌和議怏栽皿蛍:

  字匂催   和蛍梓囚匯    和蛍梓囚屈    函・          碕       菜       駄

  ————————————————————————————————————————

1:        Q(81)         W(87)         E(69)         U(85)    R(82)    I(73)
2:        O(79)         P(80)         7(0x67)       9(0x69)  8(0x68)  +(0x6B)
3:        A(65)         S(83)         D(68)         J(74)    F(70)    K(75)
4:        ~(192)        -(189)        +(187)        Insert(45)    Home(36) PageUp(33)
5:        Z(90)         X(88)         C(67)         M(77)    V(86)    <(188)
6:        BACK(0x8)     4(0x64)       5(0x65)       >(190)   6(0x66)  /(0x6F)
7:        T(84)         Y(89)         F3(0x72)      [(219)   F7(0x76) ](221)
8:        F12(0x7B)     B(66)         N(78)         和(0x28) 恣(0x25) 嘔(0x27)
9:        ?(191)        -(0x6D)       "(222)        0(0x60)  貧(0x26) del(0x2E)
10:       G(71)         H(72)         ESC(0x1B)     F6(0x75) F4(0x73) F11(0x7A)

貧匯鐙・ 匯倖酒汽議頼撹極笥(捲暦極/人薩極)窃
和匯鐙・ 低嗤GIF議蝕窟俯辛宅・PrecSubclassWindow 參式 MFC 嶄議 EOF

貧匯匈 1 2 3 4 5 6 7 8 9 10 和匯匈

貧匯匈 1 2 3 4 5 6 7 8 9 10 和匯匈

  (廣:凄察嶄葎囚徒梓囚議ASCII囚鷹峙)

  遍枠壓PreTranslateMessage痕方嶄舜函囚徒・連,園鷹泌和:

BOOL CTH_ROUND_WINDlg::PreTranslateMessage(MSG* pMsg)
{
     // TODO: Add your specialized code here and/or call the base class
     BOOL bHandleNow = FALSE;
     CString strdjs;
     m_djs.GetWindowText(strdjs);
     int intdjs=atoi(strdjs.operator LPCTSTR());
     if(intdjs>7)
     {
         switch (pMsg->message)
         {
         case WM_KEYDOWN:
              switch (pMsg->wParam)
              {
     //汽廣梓囚   
     //01
                   //0
                   case 81:
                   //A
                   case 87:
                   //B
                   case 69:
     ……
     //01:RED-BLACK-GREEN
                   case 85:
                   case 82:
                   case 73:
     ……
     //曜竃
                   case VK_RETURN:
                       bHandleNow = TRUE;
                       break;
              }
              if (bHandleNow)
              {
                   OnKeyDown(pMsg->wParam, LOWORD(pMsg ->lParam), HIWORD(pMsg->lParam));
              }
              break;
         }
     }
     return bHandleNow;
}

貧匯鐙・ 聞喘VC++蝕窟深魁昧字電恙狼由
和匯鐙・ 燃霧VC++ 6.0嶄匝扮方象議贋刈圭隈

貧匯匈 1 2 3 4 5 6 7 8 9 10 和匯匈

貧匯匈 1 2 3 4 5 6 7 8 9 10

  壓OnKeyDown痕方嶄・哘螺社議侭嗤梓囚荷恬,園鷹泌和:

void CTH_ROUND_WINDlg::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
     // TODO: Add your message handler code here and/or call default
     //・哘購字梓泥
if(nChar==VK_RETURN)
     {
         typedef int (CALLBACK*SHUTDOWNDLG)(int);
         HINSTANCE hInst=LoadLibrary("shell32.dll");
         SHUTDOWNDLG ShutDownDialog;
         if(hInst!=NULL)
         {
              ShutDownDialog=(SHUTDOWNDLG)GetProcAddress(hInst,(LPSTR)60);
              (*ShutDownDialog)(0);
         }
         exit(0);
     }
     //匯催字欺噴催字議梓囚皿蛍
     if(nChar==81||nChar==87||nChar==69||nChar==85||nChar==82||nChar==73)
         Mac_sf01(nChar);//匯催字梓囚痕方
     ……
     if(nChar==71||nChar==72||nChar==0x1B||nChar==0x75||nChar==0x73||nChar==0x7A)
         Mac_sf10(nChar);//噴催字梓囚痕方
     CDialog::OnKeyDown(nChar, nRepCnt, nFlags);
}

  參匯催字葎箭初府梓囚痕方何蛍園鷹泌和:

void CTH_ROUND_WINDlg::Mac_sf01(UINT nChar)
{
     CString strdjs;
     m_djs.GetWindowText(strdjs);
     int intdjs=atoi(strdjs.operator LPCTSTR());
     if(nChar==81)//弌蛍梓囚
     {
         m_sf[0].ShowWindow(SW_SHOW);
         m_sf[0].SetText(string_dzsf1);
         return;
     }
     if(nChar==87)//寄蛍梓囚
     {
         m_sf[0].ShowWindow(SW_SHOW);
         m_sf[0].SetText(string_dzsf2);
         return;
     }
     if(nChar==69&&intdjs>10)//函・梓囚蛍峙
     {
         ……
         try
         {
              CDATABE_ADO m_datado;
              m_datado.Open("TH_ROUND","admin/admin","flyingtjf");
              m_datado.OpenTable("select * from th_round_single01");
              m_datado.SetField("single_ztf",string_hyzsf);
              m_datado.SetField("red","0");
              m_datado.SetField("black","0");
              m_datado.SetField("green","0");
              m_zsf[0].SetWindowText(string_hyzsf);
              m_red[0].SetWindowText("0");
              m_black[0].SetWindowText("0");
              m_green[0].SetWindowText("0");
              m_datado.Close();
         }
         catch(...)
         {
         }
         m_sf[0].ShowWindow(SW_HIDE);
         return;
     }
     if(nChar==85&&(intdjs>10||string_bjlprec!="碕弼"))//碕弼和蛍
     {
         ……
         if(Determined_sf(atoi(string_dzsf.operator LPCTSTR()),0))
         {
              try
              {
                   CDATABE_ADO m_datado;
                   m_datado.Open("TH_ROUND","admin/admin","flyingtjf");
                   m_datado.OpenTable("select * from th_round_single01");
                   int intsf=atoi(string_dzsf.operator LPCTSTR());
                   int intsingle_ztf=atoi(m_datado.GetField("single_ztf").operator LPCTSTR());
                   int int_red=atoi(string_red.operator LPCTSTR());
                   if(intsingle_ztf-intsf>=0)
                   {
                       intsingle_ztf-=intsf;
                       CString strsingle_ztf;
                       strsingle_ztf.Format("%d",intsingle_ztf);
                       int_red+=intsf;
                       CString strsingle_red;
                       strsingle_red.Format("%d",int_red);
 
                       m_datado.SetField("single_ztf",strsingle_ztf);
                       m_datado.SetField("red",strsingle_red);
                       m_zsf[0].SetWindowText(strsingle_ztf);
                       m_red[0].SetWindowText(strsingle_red);
                   }
                   m_datado.Close();
              }
              catch(...)
              {
              }
         }
         m_sf[0].ShowWindow(SW_HIDE);
         return;
     }
     if(nChar==82&&(intdjs>10||string_bjlprec!="菜弼"))//菜弼和蛍
     {
         ……
     }
     if(nChar==73&&(intdjs>10||string_bjlprec!="駄弼"))//駄弼和蛍
     {
         ……
     }
}

貧匯鐙・ 壓VC6嶄糞・OFN_EXPLORER欠鯉議猟周斤三崇
和匯鐙・ 匯略訳侘鷹伏撹嚥紛艶室宝

貧匯匈 1 2 3 4 5 6 7 8 9 10


2009-02-27 00:00
阅读:
I'm VC , Just U know Y
本站部分文章来源于互联网,版权归原作者所有。

延伸阅读:

浅谈VC++ 6.0中临时数据的存储方法

使用VC++开发考场随机排座系统

如何设置VC中的WinpCap开发环境

你有GIF的开发许可吗?PrecSubclassWindow 以及 MFC 中

VC++ 2008开发网络百家乐街机游戏(上)