WEB开发网
开发学院软件开发VC VC++ 2008开发网络百家乐街机游戏(下) 阅读

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

 2009-02-27 20:03:11 来源:WEB开发网   
核心提示: 运行界面截图如下:本模块还提供将游戏路单数据导入文本文件做电子存储的功能,函数如下:void CTH_ROUND_CTLView::OnBnClickedKlButton(){ // TODO: 在此添加控件通知处理程序代码 CFileDialog dlgFileOpen(FALSE);

运行界面截图如下:

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(...)
         {
         }
     }
}

上一页  1 2 3 4 5 6 7 8  下一页

Tags:VC 开发 网络

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接