www.pudn.com > mfcopentree.rar > MfcopenDoc.cpp
// MfcopenDoc.cpp : implementation of the CMfcopenDoc class //武汉华中科技大学,2002,(C)版权所有 //作者:金德才 联系方式:iskyflying@163.com //请不要将本软件的任何一部分用于商业用途 //如果您觉得任何地方有用或者错误,请告诉作者,谢谢! //如果你想引用部分源程序,请注明作者信息 //////////////////////////////////////// #include "stdafx.h" #include "Mfcopen.h" #include "MainFrm.h" #include "MfcopenDoc.h" #include "MfcopenView.h" #include "childtree.h" #include "TransParaDlg.h" #include "TypeDlg.h" #include "InformationReport.h" #include// Header File For The OpenGL32 Library #include // Header File For The GLu32 Library #include // Header File For The Glaux Library #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif static CTypeDlg dlg; ///////////////////////////////////////////////////////////////////////////// // CMfcopenDoc IMPLEMENT_DYNCREATE(CMfcopenDoc, CDocument) BEGIN_MESSAGE_MAP(CMfcopenDoc, CDocument) //{{AFX_MSG_MAP(CMfcopenDoc) ON_UPDATE_COMMAND_UI(ID_SAVE_ANIMAL, OnUpdateSaveAnimal) ON_COMMAND(ID_OPENANIMAL, OnOpenanimal) ON_COMMAND(ID_BUILD_NEW, OnBuildNew) ON_COMMAND(IDM_LOOKUP, OnLookup) ON_COMMAND(ID_APP_EXIT, OnAppExit) ON_COMMAND(ID_SAVE_ANIMAL, OnSaveAnimal) ON_COMMAND(ID_OPEN_FAK, OnOpenFak) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CMfcopenDoc construction/destruction static int vv = 0; int progout = 0; CMfcopenDoc::CMfcopenDoc() { // TODO: add one-time construction code here ResetData(); } CMfcopenDoc::~CMfcopenDoc() { STLArray *tt; while(m_array != NULL) { tt = m_array; m_array = m_array->next; while(tt->stl != NULL) { STLData *temp; temp = tt->stl; tt->stl = tt->stl->next; delete temp; } delete tt; } if(webtri) delete []webtri; } BOOL CMfcopenDoc::OnNewDocument() { if (!CDocument::OnNewDocument()) return FALSE; // TODO: add reinitialization code here // (SDI documents will reuse this document) return TRUE; } ///////////////////////////////////////////////////////////////////////////// // CMfcopenDoc serialization void CMfcopenDoc::Serialize(CArchive& ar) { CString str; CMainFrame* pFrame; pFrame=(CMainFrame*)AfxGetApp()->m_pMainWnd; pStatus=&pFrame->m_wndStatusBar; if (ar.IsStoring())//&&m_bfileopen { // TODO: add storing code here } else { // TODO: add loading code here if(dlg.DoModal()==IDOK) { m_stype = dlg.m_type; m_savetype[m_iDArrnumber] = m_stype; m_sname = dlg.m_name; m_savename[m_iDArrnumber] = m_sname; dlg.m_name = m_sname; dlg.m_type = m_stype; } else { return; } if(m_iDArrnumber>=1) { pStatus->SetPaneText(0, "文件即将全部重新处理,请多待片刻...", true); ::Sleep(1000); } CString extname = ".stl"; file = ar.GetFile(); CString filename, filepath, filetitle; filename = file->GetFileName(); filepath = file->GetFilePath(); filetitle = file->GetFileTitle(); filename.MakeLower(); filetitle.MakeLower(); if(filetitle == filename) { int length = filename.GetLength(); char temps[5] = ""; int i = 0; while( i < 4 ) { temps[i] = filename.GetAt(length-4+i); i++; } temps[i] = '\0'; if(strcmp(temps, extname)!=0 ) { MessageBox(NULL, "stl,please!", "HINT", MB_OK); m_bfileopen = false; return; } } else { if((filetitle+extname)!= filename) { MessageBox(NULL, "stl,please!", "HINT", MB_OK); m_bfileopen = false; return; } } szFilename = filename; STLData *stl; stl = new STLData; for(int j=0; j<3; j++) { stl->fNormal[j] = 1.0f; stl->fPoint1[j] = 0.0f; stl->fPoint2[j] = 0.0f; stl->fPoint3[j] = 0.0f; } stl->next = NULL; int long leng = file->GetLength(); char filehead[80]; if(ar.Read(filehead, sizeof(filehead)) != 80) { MessageBox(NULL, "不是有效的STL文件!", "HINT", MB_OK); m_bfileopen = false; delete stl; return; } int trinum = 0; if(ar.Read(&trinum, sizeof(trinum)) != 4) { MessageBox(NULL, "!", "HINT", MB_OK); m_bfileopen = false; delete stl; return; } m_Trinumber += trinum; if( leng != 84+50*trinum ) { MessageBox(NULL, "不是有效的STL文件", "HINT", MB_OK); m_bfileopen = false; delete stl; return; } j = 0; STLData *temp = stl; for(int i=0; i fNormal, sizeof(node->fNormal)) != 12) { MessageBox(NULL, "!2", "HINT", MB_OK); m_bfileopen = false; return; } if(ar.Read(node->fPoint1, sizeof(node->fPoint1)) != 12) { MessageBox(NULL, "!3", "HINT", MB_OK); m_bfileopen = false; return; } if(ar.Read(node->fPoint2, sizeof(node->fPoint2)) != 12) { MessageBox(NULL, "!4", "HINT", MB_OK); m_bfileopen = false; return; } if(ar.Read(node->fPoint3, sizeof(node->fPoint3)) != 12) { MessageBox(NULL, "!5", "HINT", MB_OK); m_bfileopen = false; return; } short ishort; if(ar.Read(&ishort, sizeof(ishort)) != 2) { MessageBox(NULL, "!6", "HINT", MB_OK); m_bfileopen = false; return; } node->next = NULL; temp->next = node; temp = node; j++; int prog = j*100/trinum; str.Format( "已读取文件%d%%", prog ); pStatus->SetPaneText(0, str, true); } m_bfileopen = true; if(m_bfileopen) { if(m_iDArrnumber>0) RestoreData(m_array); m_iDArrnumber++; m_loadfilename[m_iDArrnumber] = filepath; float tempboxsize[3] = {0}; float tempcenter[3] = {0}; FoundBox(stl, tempboxsize, tempcenter); for(int ganshe=0; ganshe<3; ganshe++) { m_fboxsize[m_iDArrnumber][ganshe] = tempboxsize[ganshe]; m_fcenter[m_iDArrnumber][ganshe] = tempcenter[ganshe]; } //加入到动态链表中 STLArray *arraynode = new STLArray; arraynode->flag = m_iDArrnumber; arraynode->trinumber = trinum; arraynode->boxsize[0] = tempboxsize[0]; arraynode->boxsize[1] = tempboxsize[1]; arraynode->boxsize[2] = tempboxsize[2]; arraynode->center[0] = tempcenter[0]; arraynode->center[1] = tempcenter[1]; arraynode->center[2] = tempcenter[2]; arraynode->stl = stl; arraynode->next = NULL; arraytemp->next = arraynode; arraytemp = arraynode; //加到“工作中心” CChildTree* pTree=(CChildTree*)&pFrame->m_cTree; pTree->AddSTLDentity(m_sname, m_stype); } } } ///////////////////////////////////////////////////////////////////////////// // CMfcopenDoc diagnostics #ifdef _DEBUG void CMfcopenDoc::AssertValid() const { CDocument::AssertValid(); } void CMfcopenDoc::Dump(CDumpContext& dc) const { CDocument::Dump(dc); } #endif //_DEBUG ///////////////////////////////////////////////////////////////////////////// // CMfcopenDoc commands CMfcopenDoc::FoundBox(STLData *data, float boxsize[3], float center[3]) { STLData *temp = data->next; float m_ftempdefmax[3] = {-100.0, -100.0, -100.0}; float m_ftempdefmin[3] = {100.0, 100.0, 100.0}; while( temp != NULL ) { for( int i=0; i<3; i++ ) { if( temp->fPoint1[i] > m_ftempdefmax[i] ) m_ftempdefmax[i] = temp->fPoint1[i]; if( temp->fPoint1[i] < m_ftempdefmin[i]) m_ftempdefmin[i] = temp->fPoint1[i]; if( temp->fPoint2[i] > m_ftempdefmax[i] ) m_ftempdefmax[i] = temp->fPoint2[i]; if( temp->fPoint2[i] < m_ftempdefmin[i]) m_ftempdefmin[i] = temp->fPoint2[i]; if( temp->fPoint3[i] > m_ftempdefmax[i] ) m_ftempdefmax[i] = temp->fPoint3[i]; if( temp->fPoint3[i] < m_ftempdefmin[i]) m_ftempdefmin[i] = temp->fPoint3[i]; } temp = temp->next; } //算出它的box float box_x_temp = m_ftempdefmax[0] - m_ftempdefmin[0]; float box_y_temp = m_ftempdefmax[1] - m_ftempdefmin[1]; float box_z_temp = m_ftempdefmax[2] - m_ftempdefmin[2]; //记录它的box boxsize[0] = box_x_temp; boxsize[1] = box_y_temp; boxsize[2] = box_z_temp; //记录它的中心点 center[0] = box_x_temp/2.0 + m_ftempdefmin[0]; center[1] = box_y_temp/2.0 + m_ftempdefmin[1]; center[2] = box_z_temp/2.0 + m_ftempdefmin[2]; //和最大、小的比较 m_fdefmin[0] = m_fdefmin[0] m_ftempdefmax[0]?m_fdefmax[0]:m_ftempdefmax[0]; m_fdefmax[1] = m_fdefmax[1]>m_ftempdefmax[1]?m_fdefmax[1]:m_ftempdefmax[1]; m_fdefmax[2] = m_fdefmax[2]>m_ftempdefmax[2]?m_fdefmax[2]:m_ftempdefmax[2]; //box比较 m_fbox_x = m_fdefmax[0] - m_fdefmin[0]; m_fbox_y = m_fdefmax[1] - m_fdefmin[1]; m_fbox_z = m_fdefmax[2] - m_fdefmin[2]; float tempboxmax = (m_fbox_x > m_fbox_y )?m_fbox_x:m_fbox_y; float m_ftempBoxMax = (tempboxmax > m_fbox_z)?tempboxmax:m_fbox_z; m_fBoxMax = (m_fBoxMax > m_ftempBoxMax)?m_fBoxMax:m_ftempBoxMax; } void CMfcopenDoc::RestoreData(STLArray *data) { STLArray *temparray = data; int ii=0; while(temparray!=NULL) { STLData *tempdata = temparray->stl; m_fcenter[ii][0] = temparray->center[0] ; m_fcenter[ii][1] = temparray->center[1] ; m_fcenter[ii][2] = temparray->center[2] ; m_fboxsize[ii][0] = temparray->boxsize[0] ; m_fboxsize[ii][1] = temparray->boxsize[1] ; m_fboxsize[ii][2] = temparray->boxsize[2] ; while(tempdata!=NULL) { for(int i=0; i<3; i++) { tempdata->fPoint1[i] *= m_fBoxMax; tempdata->fPoint2[i] *= m_fBoxMax; tempdata->fPoint3[i] *= m_fBoxMax; } tempdata = tempdata->next; } temparray = temparray->next; ii++; } } int m_isavetimes = 0; void CMfcopenDoc::OnSaveAnimal() { int tt; //第一次保存 if(m_isavetimes == 0) { char szFiter[] = "epc Files (*.epc)|*.epc||"; CFileDialog dlg(FALSE,"保存所有设定的数据到文件",NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, szFiter,NULL); dlg.m_ofn.lpstrTitle="保存所有设定的数据到文件"; tt = dlg.DoModal(); if(tt == IDCANCEL) return; m_ssavefilename = dlg.m_ofn.lpstrFile; m_isavetimes++; } else tt = IDOK; if(tt==IDOK) { CFile file(m_ssavefilename, CFile::modeReadWrite|CFile::modeCreate); POSITION pos = GetFirstViewPosition(); CMfcopenView *pview = (CMfcopenView *)GetNextView(pos); char head[39] = {"19780920_20011114_jindecai_mfcopen_epc"}; file.Write(head, 38); //文件个数信息 file.Write(&m_iDArrnumber, 4); //最大box信息 file.Write(&m_fBoxMax, 4); for(int i=1; i<=m_iDArrnumber; i++) { //文件位置信息 int length = 0; length = m_loadfilename[i].GetLength()+1; file.Write(&length, 4); file.Write(m_loadfilename[i], length); //类型名称信息 length = m_savename[i-1].GetLength()+1; file.Write(&length, 4); file.Write(m_savename[i-1], length); length = m_savetype[i-1].GetLength()+1; file.Write(&length, 4); file.Write(m_savetype[i-1], length); //每个实体被平移过几次 file.Write(&(pview->m_itrannumber[i]), 4); for(int j=0; j m_itrannumber[i]; j++) { //最终位置数据 file.Write(&(pview->m_fInformation[i][j][0]), 4); file.Write(&(pview->m_fInformation[i][j][1]), 4); file.Write(&(pview->m_fInformation[i][j][2]), 4); //运动信息 file.Write(&(pview->m_fmove[i][j][0]), 4); file.Write(&(pview->m_fmove[i][j][1]), 4); file.Write(&(pview->m_fmove[i][j][2]), 4); file.Write(&(pview->m_fmove[i][j][3]), 4); //时间数据 file.Write(&(pview->m_ftimemove[i][j][0]), 4); file.Write(&(pview->m_ftimemove[i][j][1]), 4); } //速度控制参数 file.Write(&(pview->m_ftimes), 4); //颜色信息 file.Write(&(pview->mat_amb_diff[i][0]), 4); file.Write(&(pview->mat_amb_diff[i][1]), 4); file.Write(&(pview->mat_amb_diff[i][2]), 4); //隐藏信息 file.Write(&(pview->m_ilflag[i]), 4); //放大倍数 file.Write(&(pview->m_scale), 4); //原始位置的中心坐标和box信息 file.Write(&(pview->m_forigincenter[i][0]), 4); file.Write(&(pview->m_forigincenter[i][1]), 4); file.Write(&(pview->m_forigincenter[i][2]), 4); file.Write(&(pview->m_fboxsize[i][0]), 4); file.Write(&(pview->m_fboxsize[i][1]), 4); file.Write(&(pview->m_fboxsize[i][2]), 4); } file.Close(); } } void CMfcopenDoc::OnUpdateSaveAnimal(CCmdUI* pCmdUI) { // TODO: Add your command update UI handler code here } void CMfcopenDoc::OnOpenanimal() { // TODO: Add your command handler code here char szFiter[] = "epc Files (*.epc)|*.epc||"; CFileDialog dlg(TRUE,"打开epc文件",NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, szFiter,NULL); POSITION pos = GetFirstViewPosition(); CMfcopenView *pview = (CMfcopenView *)GetNextView(pos); int isgo = dlg.DoModal(); if(isgo == IDOK) { CString str = dlg.GetFileName(); if(szFilename.Compare(str)==0) return; szFilename = str; CFile file; if(file.Open(str, CFile::modeRead)) { char buffer[39]; DWORD dwremain = file.GetLength(); //检查是否是正确的文件 if((file.Read(buffer, 38)) != 38) { MessageBox(NULL, "!", "HINTS!", MB_OK); file.Close(); return; } buffer[38] = '\0'; if(strcmp(buffer, "19780920_20011114_jindecai_mfcopen_epc") != 0) { MessageBox(NULL, "不是epc格式文件!", "HINTS", MB_OK); file.Close(); return; } //得到文件的数量 int m_ifilenumber; if((file.Read(&m_ifilenumber, 4)) != 4) { MessageBox(NULL, "!!", "HINTS!", MB_OK); file.Close(); return; } //读取最大的边长 if((file.Read(&m_fepcboxmax, 4)) != 4) { MessageBox(NULL, "!!!", "HINTS!", MB_OK); file.Close(); return; } m_fBoxMax = (m_fepcboxmax > m_fBoxMax) ? m_fepcboxmax : m_fBoxMax; //对每个文件读取相关信息 for(int i=0; i fNormal[k] = 1.0f; stl->fPoint1[k] = 0.0f; stl->fPoint2[k] = 0.0f; stl->fPoint3[k] = 0.0f; } stl->next = NULL; int long leng = fp.GetLength(); char filehead[80]; if(fp.Read(filehead, sizeof(filehead)) != 80) { MessageBox(NULL, "不是有效的STL文件!", "HINT", MB_OK); fp.Close(); delete stl; return; } int long trinum = 0; if(fp.Read(&trinum, sizeof(trinum)) != 4) { MessageBox(NULL, "!", "HINT", MB_OK); fp.Close(); delete stl; return; } m_Trinumber += trinum; if( leng != 84+50*trinum ) { MessageBox(NULL, "不是有效的STL文件", "HINT", MB_OK); fp.Close(); delete stl; return; } k = 0; STLData *temp = stl; for(int m=0; m fNormal, sizeof(node->fNormal)) != 12) { MessageBox(NULL, "!2", "HINT", MB_OK); fp.Close(); return; } if(fp.Read(node->fPoint1, sizeof(node->fPoint1)) != 12) { MessageBox(NULL, "!3", "HINT", MB_OK); fp.Close(); return; } if(fp.Read(node->fPoint2, sizeof(node->fPoint2)) != 12) { MessageBox(NULL, "!4", "HINT", MB_OK); fp.Close(); return; } if(fp.Read(node->fPoint3, sizeof(node->fPoint3)) != 12) { MessageBox(NULL, "!5", "HINT", MB_OK); fp.Close(); return; } short ishort; if(fp.Read(&ishort, sizeof(ishort)) != 2) { MessageBox(NULL, "!6", "HINT", MB_OK); fp.Close(); return; } node->next = NULL; temp->next = node; temp = node; } m_iDArrnumber++; m_loadfilename[m_iDArrnumber] = p; //加入到动态链表中 STLArray *arraynode = new STLArray; arraynode->flag = m_iDArrnumber; arraynode->trinumber = trinum; arraynode->stl = stl; arraynode->next = NULL; arraytemp->next = arraynode; arraytemp = arraynode; //关闭stl文件 fp.Close(); //单个stl已读取完毕,以下将赋予它动画信息 //名字 if((file.Read(&length, 4) != 4)) { MessageBox(NULL, "error1", "HINTS!", MB_OK); file.Close(); return; } char *q = new char [length]; if((file.Read(q, length) != (UINT)length)) { MessageBox(NULL, "ERROR", "HINT", MB_OK); file.Close(); return; } m_sname = q; m_savename[m_iDArrnumber-1] = m_sname; //类型 if((file.Read(&length, 4) != 4)) { MessageBox(NULL, "error1", "HINTS!", MB_OK); file.Close(); return; } char *r = new char[length]; if((file.Read(r, length) != (UINT)length)) { MessageBox(NULL, "ERROR", "HINT", MB_OK); file.Close(); return; } m_stype = r; m_savetype[m_iDArrnumber-1] = m_stype; //加到“工作中心” CMainFrame* pFrame; pFrame=(CMainFrame*)AfxGetApp()->m_pMainWnd; CChildTree* pTree=(CChildTree*)&pFrame->m_cTree; pTree->AddSTLDentity(m_sname, m_stype); if((file.Read(&m_itrannumber[i+1], 4) != 4)) { MessageBox(NULL, "error1", "HINTS!", MB_OK); file.Close(); return; } for(int j=0; j m_pMainWnd; COutputBar *m_output = &(pFrame->m_wndOutput); static int writer = 0; if(writer > 0) m_output->m_DebugList.ResetContent(); writer++; CString str; str = " 当 前 所 有 实 体 的 信 息\n"; m_output->m_DebugList.AddString(str); str = "------------------------------------------------------------------------------------------------------------------------------------\n"; m_output->m_DebugList.AddString(str); str = "实体序列 实体类型 实体名 次数 X平移 Y平移 Z平移 起始时间 终止时间 速度控制 隐藏\n"; m_output->m_DebugList.AddString(str); for(int i=1; i<=m_iDArrnumber; i++) { if(pview->m_itrannumber[i] == 0) { str.Format(" %d %s %s %d %10.6f %10.6f %10.6f %10.6f %10.6f %10.6f %c\n",\ i, m_savetype[i-1], m_savename[i-1], 0, pview->m_fInformation[i][0][0], pview->m_fInformation[i][0][1], pview->m_fInformation[i][0][2] , pview->m_ftimemove[i][0][0], pview->m_ftimemove[i][0][1], pview->m_ftimes, (pview->m_ilflag[i]==1)?'Y':'N'); m_output->m_DebugList.AddString(str); } else { for(int j=0; j m_itrannumber[i]; j++) { if(pview->m_ftimemove[i][j][0] == pview->m_ftimemove[i][j][1]) continue; str.Format(" %d %s %s %d %10.6f %10.6f %10.6f %10.6f %10.6f %10.6f %c\n",\ i, m_savetype[i-1], m_savename[i-1], j+1, pview->m_fInformation[i][j][0], pview->m_fInformation[i][j][1], pview->m_fInformation[i][j][2], pview->m_ftimemove[i][j][0], pview->m_ftimemove[i][j][1], pview->m_ftimes, (pview->m_ilflag[i]==1)?'Y':'N'); m_output->m_DebugList.AddString(str); } } } } void CMfcopenDoc::OnAppExit() { // TODO: Add your command handler code here if(!m_bfileopen&&!m_banimalfileopen) { PostQuitMessage(0); } else { int tt = MessageBox(NULL, "您想保存已修改的数据吗?", "停一停", MB_YESNOCANCEL); if(tt == IDYES) { OnSaveAnimal(); CDocument::OnCloseDocument(); PostQuitMessage(0); } else if(tt == IDCANCEL) return; else { CDocument::OnCloseDocument(); PostQuitMessage(0); } } } void CMfcopenDoc::ResetData() { m_bFakOpen = false; m_fbox_x = -100; m_fbox_y = -100; m_fbox_z = -100; m_fBoxMax = -100; m_iDArrnumber = 0; m_Trinumber = 0; m_bfileopen = false; m_banimalfileopen = FALSE; for( int i=0; i<3; i++ ) { m_fdefmax[i] = -10000; m_fdefmin[i] = +10000; } for(i=0; i<100; i++) { m_itrannumber[i] = 0; for(int u=0; u<4; u++) { m_ftimemove[i][u][0] = 0; m_ftimemove[i][u][1] = 0; } } for(i=0; i<100; i++) for(int k=0; k<4; k++) for(int j=0; j<4; j++) m_fmove[i][k][j] = 0; for( i=0; i<100; i++) { m_loadfilename[i] = ""; m_savename[i] = ""; m_savetype[i] = ""; m_ilflag[i] = 0; } m_array = new STLArray; m_array->flag = 0; m_array->trinumber = 0; m_array->boxsize[0] = 0; m_array->boxsize[1] = 0; m_array->boxsize[2] = 0; m_array->center[0] = m_array->center[1] = m_array->center[2] = 0; m_array->stl = NULL; m_array->next = NULL; arraytemp = m_array; for(int q=0; q<100; q++) { mat_amb_diff[q][0] = 1.0f; mat_amb_diff[q][1] = 0.2F; mat_amb_diff[q][2] = 0.2f; mat_amb_diff[q][3] = 1.0f; for(int w=0; w<4; w++) { m_fInformation[q][w][0] = 0; m_fInformation[q][w][1] = 0; m_fInformation[q][w][2] = 0; } } file = 0; webtri = 0; } void CMfcopenDoc::OnOpenFak() { // TODO: Add your command handler code here char szFiter[] = "FAK Files (*.fak)|*.fak||"; CFileDialog dlg(TRUE,"打开FAK文件",NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, szFiter,NULL); POSITION pos = GetFirstViewPosition(); CMfcopenView *pview = (CMfcopenView *)GetNextView(pos); int isgo = dlg.DoModal(); if(isgo == IDOK) { CString str = dlg.GetFileName(); if(szFilename.Compare(str)==0) return; szFilename = str; CFile file; if(file.Open(str, CFile::modeRead)) { char buffer[20]; DWORD dwremain = file.GetLength(); //检查是否是正确的文件 if((file.Read(buffer, 19)) != 19) { MessageBox(NULL, "!", "HINTS!", MB_OK); file.Close(); return; } buffer[19] = '\0'; if(strcmp(buffer, "jindecai20021007fak") != 0) { MessageBox(NULL, "不是FAK格式文件!", "HINTS", MB_OK); file.Close(); return; } int trinum; if(file.Read(&trinum, 4) != 4) { MessageBox(NULL, "!", "HINTS!", MB_OK); file.Close(); return; } m_Trinumber = trinum; webtri = new WebTri[trinum]; for(int i=0; i