// YLGL.cpp : Defines the class behaviors for the application. // #include "stdafx.h" #include "YLGL.h" #include "ChildFrm.h" #include "YLGLDoc.h" #include "YLGLView.h" #include "ChoosePhotoSkin.h" #include "DBConfig.h" #include "Lzari.h" #include #include "library.h" /********IsExistFolder**********/ #include #include #include /********IsExistFolder**********/ #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif MainFrimDlg2 *g_pMainWnd2=NULL; ///////////////////////////////////////////////////////////////////////////// // CYLGLApp FILE *g_pf; // add by Jeff 2014.05.24 #define _USE_CONSOLE_FOR_DEBUG 0 // add by Jeff 2014.05.24 BEGIN_MESSAGE_MAP(CYLGLApp, CWinApp) ON_COMMAND(ID_APP_ABOUT, OnAppAbout) ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew) ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen) END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CYLGLApp construction DEVMODE g_dm; // 打印或显示设备的预设值和环境值; CYLGLApp::CYLGLApp() { // TODO: add code here, // Place all significant initialization in InitInstance g_gridcol1 g_dm.dmSize = sizeof(DEVMODE) ; EnumDisplaySettings(NULL,ENUM_CURRENT_SETTINGS,&g_dm); // 返回显示设备的当前设置的绘图模式; CRect rc; HWND wnd = GetDesktopWindow(); if(wnd) { ::GetWindowRect (wnd, &rc); g_screenwid=rc.Width(); g_screenhei=rc.Height(); } else { g_screenwid=g_dm.dmPelsWidth; g_screenhei=g_dm.dmPelsHeight; } g_fscalex=(float)g_screenwid/1024.0; g_fscaley=(float)g_screenhei/768.0; /* begin Jeff 这段代码未有使用意义 */ wnd = ::FindWindow("Shell_TrayWnd", 0); ::GetWindowRect (wnd, &rc); int hei=rc.Height(); rc=CRect(0,0,g_screenwid,g_screenhei-hei); /* end Jeff 这段代码未有使用意义 */ g_fscalex=(float)g_screenwid/2000.0; g_fscaley=(float)(g_screenhei-hei)/1400.0; } ///////////////////////////////////////////////////////////////////////////// // The one and only CYLGLApp object CYLGLApp theApp; ///////////////////////////////////////////////////////////////////////////// // CYLGLApp initialization g_serverarray ///////////////////////////////////////////////////////////////////////////// // CAboutDlg dialog used for App About class CAboutDlg : public CDialog { public: CAboutDlg(); enum { IDD = IDD_ABOUTBOX }; protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support // Implementation protected: //{{AFX_MSG(CAboutDlg) // No message handlers //}}AFX_MSG DECLARE_MESSAGE_MAP() }; CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD) { } void CAboutDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); } BEGIN_MESSAGE_MAP(CAboutDlg, CDialog) //{{AFX_MSG_MAP(CAboutDlg) // No message handlers //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// // CYLGLApp message handlers BOOL CYLGLApp::InitInstance() { #if _USE_CONSOLE_FOR_DEBUG // Jeff.控制台输出信息; AllocConsole(); // 开辟控制台 SetConsoleTitle(_T("+lyfz:调试信息输出++++++")); // 设置控制台窗口标题 //FILE* g_pf; //freopen(&pf,"CONOUT$","w",stdout); // 重定向输出 //g_pf=freopen("CONOUT$","w+t",stdout); // 重定向输出 //g_pf=freopen("CONIN$","r+t",stdin); // 重定向输入 freopen("CONOUT$","w+t",stdout); // 重定向输出 freopen("CONIN$","r+t",stdin); // 重定向输入 #endif //printf("Jeff:m_lpCmdLine = %s\n\n",m_lpCmdLine);//Jeffprintf // Jeff.命令行genbranchdata值,由本机服务端DBServer.exe执行输入; // 使用批处理可以指定这个命令行的内容 // // ---------批处理--------------- // @echo off // start %~dp0YLGL.exe genbranchdata // ---------批处理-------------- // // DBServer.exe调用Shell命令传入该命令行genbranchdata值; if(m_lpCmdLine[0] == _T('\0')) //没有命令行参数 { } else { CString str=m_lpCmdLine; if(str=="genbranchdata") { g_bGenBranchData=1; } } if(g_bGenBranchData==0) { HANDLE hObject = CreateMutex(NULL,FALSE,_T("CYLGLAppXiao")); if(GetLastError() == ERROR_ALREADY_EXISTS) { AfxMessageBox("提醒:软件已启动!", MB_ICONINFORMATION); } } AfxEnableControlContainer(); /////////////////////////////////////////////////// // Standard initialization // If you are not using these features and wish to reduce the size // of your final executable, you should remove from the following // the specific initialization routines you do not need. g_listctrlfont.CreatePointFont(110, _T("System")); //g_listctrlfont.CreatePointFont (110, _T("宋体")); // g_listctrlfont.CreatePointFont (90, _T("微软雅黑")); #ifdef _AFXDLL Enable3dControls(); // Call this when using MFC in a shared DLL #else Enable3dControlsStatic(); // Call this when linking to MFC statically #endif GetFileVersion(NULL, g_arrFileVersion); // Jeff:dbconfig.dat里的信息,可以包含*.ly.com和计算机名称、IP地址三种; // 1.*.ly.com的需要解析出分店的IP地址; // 2.*.ly.com的解析是需要连接到公司服务器软件,然后返回ip地址,保存在ip.txt里; // Jeff.dbconfig.dat里保存的是*.ly.com信息,一般是用在外网访问花生壳域名的服务端软件; char path[MAX_PATH]; ::GetModuleFileName(NULL, path, MAX_PATH); g_mainpath=path; g_mainpath=g_mainpath.Left(g_mainpath.ReverseFind('\\')); CString configpath=g_mainpath+"\\dbconfig.dat"; // 1.初始化SOCKET int nResult = Transport_Init(); if( TRANSPORT_OK != nResult) { WriteClientLog("网络初始化失败,软件退出!"); return false; } // 2.获取服务器地址; if(g_bGenBranchData) { // Jeff.启动g_bGenBranchData功能,是指由服务器DBServer.exe使用Shell命令来调用YLGL.exe并传入genbranchdata命令行 // 而此时YLGL.exe读取本机计算机名; char server[50]; DWORD leng=50; ::GetComputerName(server, &leng); g_serverbak=g_server=server; g_serverbak.TrimLeft(); g_serverbak.TrimRight("."); g_serverbak.TrimRight(); // Jeff. find(.ly.com)是不需要判断的一步; if(g_server.Find(".ly.com")==-1 && g_server.Find("192.168.")==-1 ) MyGetIPByName(g_server); if( g_server.Find("192.168.")!=-1 ) g_serverarray.Add(g_server); // printf("Jeff.g_bGenBranchData=1,g_server=%s,g_serverbak=%s\n\n",g_server,g_serverbak);//Jeffprintf } else { CFile fp; ll: if(fp.Open(configpath, CFile::modeRead)) { DBSAVE db; memset(&db, 0, sizeof(db)); fp.Read(&db, sizeof(db)); fp.Close(); char server[50]; char user[50]; char psw[50]; memset(server, 0, sizeof(char)*50); memset(user, 0, sizeof(char)*50); memset(psw, 0, sizeof(char)*50); for(int i=0; i<50; i++) { if(db.server [i]) server[i]=500-db.server [i]; if(db.user [i]) user[i]=500-db.user [i]; if(db.psw [i]) psw[i]=500-db.psw [i]; } #ifdef TEST_LOCAL DWORD leng=50; ::GetComputerName (server, &leng); #endif g_serverbak=g_server=server; g_serverbak.TrimLeft(); g_serverbak.TrimRight("."); g_serverbak.TrimRight(); if(g_server.Find(".ly.com")==-1 && g_server.Find("192.168.")==-1 ) MyGetIPByName(g_server); if( g_server.Find("192.168.")!=-1 ) g_serverarray.Add(g_server); if(g_server.IsEmpty ()) { AfxMessageBox("获取IP失败! 请确认服务器名 "+g_serverbak+" 是否正确? 或修改网络设置或与系统hosts文件!"); // g_serverarray.Add (g_serverbak); // g_server=g_serverbak; return 0; } IsShareFolderExist(server);// add by Jeff,检测共享目录是否存在可写; // 10.0.0.0/8:10.0.0.0~10.255.255.255 // 172.16.0.0/12:172.16.0.0~172.31.255.255 // 192.168.0.0/16:192.168.0.0~192.168.255.255 if(g_server.Find ("10.")!=-1 || g_server.Find ("172.")!=-1 || g_server.Find ("192.168")!=-1) { } else { // g_serverbak="localserver"; } //printf("Jeff:g_bGenBranchData=0,有ini配置文件,g_server=%s,g_serverbak=%s\n\n",g_server,g_serverbak);//Jeffprintf } else { AfxMessageBox("请先设置数据库服务器!", MB_ICONINFORMATION); DBConfig dlg; dlg.DoModal(); goto ll; return false; } } CStdioFile fp2; if(fp2.Open (g_mainpath+"\\title.txt", CFile::modeRead)) { fp2.ReadString(g_title); fp2.Close(); } //free((void*)m_pszAppName); m_pszAppName=_tcsdup(g_title+"影楼管理系统"); g_titlefont.CreatePointFont (160, _T("宋体")); // Change the registry key under which our settings are stored. // TODO: You should modify this string to be something appropriate // such as the name of your company or organization. GetOrientation SetRegistryKey(_T("LYFZ-YLGL")); CString version = _T ("Version 1.0"); g_bRedSkin=AfxGetApp()->GetProfileInt(version, "redskin", 0); if(g_bRedSkin) { g_gridcol1=RGB(241,180,198); g_gridcol2=RGB(237,157,182); g_bkcol=RGB(235,149,174); }//184, 184 g_editbkbrush.CreateSolidBrush(g_bkcol); LoadStdProfileSettings(); // Load standard INI file options (including MRU) // Register the application's document templates. Document templates // serve as the connection between documents, frame windows and views. GdiplusStartupInput gdiplusStartupInput; GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL); #if 1 CString temp; temp.Format ("%s\\regsvr32.exe /s %s\\MSCHRT20.OCX", g_mainpath,g_mainpath); WinExec(temp,SW_HIDE); #else CString temp; temp.Format ("%windir%\\system32\\regsvr32 %s\\MSCHRT20.OCX", g_mainpath,g_mainpath); int nRet = system(temp); //CString strRet; //strRet.Format("system返回值:%d",nRet); //AfxMessageBox(strRet); #endif //AfxMessageBox(temp); /* CString str="c:\\1.jpg"; Image *m_pImage=NULL; ::LoadImageFromBuf (&m_pImage, str); int orientation=GetOrientation(m_pImage); if(orientation==8) {// m_pImage->RotateFlip( Rotate270FlipNone ); AfxMessageBox("8"); } else if(orientation==6) { // m_pImage->RotateFlip( Rotate90FlipNone ); AfxMessageBox("6"); } delete m_pImage; */ // Jeff.IRStartup属于换肤库的启动函数; HINSTANCE hModule = GetModuleHandle( NULL ); IRStartup( hModule, GetCurrentThreadId() ); CMultiDocTemplate* pDocTemplate; pDocTemplate = new CMultiDocTemplate( IDR_MAINFRAME, NULL, RUNTIME_CLASS(CChildFrame), // custom MDI child frame RUNTIME_CLASS(CYLGLView)); AddDocTemplate(pDocTemplate); // create main MDI Frame window CMainFrame* pMainFrame = new CMainFrame; if (!pMainFrame->LoadFrame(IDR_MAINFRAME)) // LoadFrame调用OnCreate { return FALSE; } m_pMainWnd = pMainFrame; // 加载OfficeXP风格菜单 #ifndef NEW_SKIN CMenu* pMenu = m_pMainWnd->GetMenu(); if (pMenu)pMenu->DestroyMenu(); HMENU hMenu = ((CMainFrame*) m_pMainWnd)->NewMenu(); pMenu = CMenu::FromHandle( hMenu ); m_pMainWnd->SetMenu(pMenu); ((CMainFrame*)m_pMainWnd)->m_hMenuDefault = hMenu; #endif // Parse command line for standard shell commands, DDE, file open //////////////////////////////////////////////////// // 禁止自动新建子窗口 // CCommandLineInfo cmdInfo; // ParseCommandLine(cmdInfo); // // Dispatch commands specified on the command line // if (!ProcessShellCommand(cmdInfo)) // return FALSE; m_pMainWnd->SetWindowText (g_title+"影楼管理系统"); m_pMainWnd->UpdateWindow(); SetDialogBkColor(g_bkcol,RGB(0,0,0)); return TRUE; } BOOL CYLGLApp::IsShareFolderExist(char *szServerName) { char szPath1[MAX_PATH]={0}; sprintf(szPath1,"\\\\%s\\%s",szServerName,"电话录音(管理软件)$"); IsExistFolder(szPath1); //strcpy(szPath1,"\\\\"); //strcpy(szPath6,szServerName); //char szPath2[MAX_PATH]={0}; sprintf(szPath1,"\\\\%s\\%s",szServerName,"客户原片(管理软件)$"); IsExistFolder(szPath1); //strcpy(szPath1,"\\\\"); //strcpy(szPath6,szServerName); //char szPath3[MAX_PATH]={0}; sprintf(szPath1,"\\\\%s\\%s",szServerName,"精修好的片(管理软件)$"); IsExistFolder(szPath1); //strcpy(szPath1,"\\\\"); //strcpy(szPath6,szServerName); //char szPath4[MAX_PATH]={0}; sprintf(szPath1,"\\\\%s\\%s",szServerName,"礼服图片(管理软件)$"); IsExistFolder(szPath1); //strcpy(szPath1,"\\\\"); //strcpy(szPath6,szServerName); //char szPath5[MAX_PATH]={0}; sprintf(szPath1,"\\\\%s\\%s",szServerName,"设计好的片(管理软件)$"); IsExistFolder(szPath1); //strcpy(szPath1,"\\\\"); //strcpy(szPath6,szServerName); //char szPath6[MAX_PATH]={0}; sprintf(szPath1,"\\\\%s\\%s",szServerName,"修好的片(管理软件)$"); IsExistFolder(szPath1); //strcpy(szPath1,"\\\\"); //strcpy(szPath6,szServerName); return TRUE; } int CYLGLApp::DoMessageBox(LPCTSTR lpszPrompt, UINT nType, UINT nIDPrompt) { // TODO: Add your specialized code here and/or call the base class return CWinApp::DoMessageBox(lpszPrompt, nType, nIDPrompt); } // App command to run the dialog void CYLGLApp::OnAppAbout() { CAboutDlg aboutDlg; aboutDlg.DoModal(); } int CYLGLApp::ExitInstance() { // TODO: Add your specialized code here and/or call the base class //关闭gdiplus的环境 GdiplusShutdown(gdiplusToken); for(int i=0; iProcessChatMessageRequest2(1); if(g_bSendOK==0) return -1; DWORD leng; DWORD readbytes=0; // Jeff.remark.2014.06.26 // g_pData 里此时保存的是10.lia文件内容; // 根据10.lia的结构,解释其它内部数据; // 目前没有其结构文档解释,暂时未知10.lia内含什么数据种类; // 以下是根据代码假设的内容: // ------------------------------- // 4 byte.某文件A大小,用dwLengthA表示; // dwLengthA byte:文件A的数据 // 4 byte.某文件B大小,用dwLengthB表示; // dwLengthB byte:文件B的数据; // ------以下文件组C------------- // 4 byte.某文件组C大小,用dwLengthC表示; // dwLengthC:某文件组C的数据; // 某文件C的数据结构:RESDATA2 // 文件组C文件个数nCount = dwLengthC/sizeof(RESDATA2); //--------------------------------------- // 10.lia文件总大小:dwSum = dwLengthA+dwLengthB+dwLengthC; // 10.lia文件内数据结构种类有三种:A,B,C 其中C为一组同类型数据; // 10.lia文件内数据结构个数: 2 + nCount; // -------------------------------- ENCODE_START memcpy(&leng, g_pData+readbytes, sizeof(DWORD)); readbytes+=sizeof(DWORD); { CMemFile memfile; memfile.Attach(g_pData+readbytes, leng); readbytes+=leng; CArchive ar(&memfile, CArchive::load); g_lengarray.Serialize(ar); ar.Close(); memfile.Detach (); } memcpy(&leng, g_pData+readbytes, sizeof(DWORD)); readbytes+=sizeof(DWORD); { CMemFile memfile; memfile.Attach (g_pData+readbytes, leng); readbytes+=leng; CArchive ar(&memfile, CArchive::load); g_btnlengarray.Serialize (ar); ar.Close(); memfile.Detach (); } memcpy(&leng, g_pData+readbytes, sizeof(DWORD)); readbytes+=sizeof(DWORD); ENCODE_END int count=leng/sizeof(RESDATA2); for(int i=0; inPicBmpCount [0]); AfxMessageBox(str); str.Format ("%d", pRes->nPicBmpCount [1]); AfxMessageBox(str); str.Format ("%d", pRes->nPicBmpCount [2]); AfxMessageBox(str); str.Format ("%d", pRes->nPicBmpCount [3]); AfxMessageBox(str); str.Format ("%d", pRes->nPicBmpCount [4]); AfxMessageBox(str); str.Format ("%d", pRes->nPicBmpCount [5]); AfxMessageBox(str);*/ } } for(int i=0; idataarray; dataarray.Add (pos); dataarray.Add (leng1); dataarray.Add (leng2); dataarray.Add (leng3); dataarray.Add (leng4); dataarray.Add (leng5); dataarray.Add (leng6); dataarray.Add (leng7); dataarray.Add (leng8); memcpy(&g_resdata2, g_pointerarray.ElementAt (pos), sizeof(RESDATA2)); RESDATA2 *pRes=&g_resdata2; /* DeCodelong1( (long&)(pRes->rect[0].right), (long&)(pRes->rect[1].right), (long&)(pRes->rect[2].right), (long&)(pRes->rect[3].right), (long&)(pRes->rect[4].right), (long&)(pRes->rect[5].right), (long&)(pRes->rect[6].right), (long&)(pRes->rect[7].right) ); DeCodelong2( (long&)(pRes->rect[8].right), (long&)(pRes->rect[9].right), (long&)(pRes->rect[10].right), (long&)(pRes->rect[11].right), (long&)(pRes->rect[12].right), (long&)(pRes->rect[13].right), (long&)(pRes->rect[14].right), (long&)(pRes->rect[15].right) ); DeCodelong3( (long&)(pRes->rect[0].left), (long&)(pRes->rect[1].left), (long&)(pRes->rect[2].left), (long&)(pRes->rect[3].left), (long&)(pRes->rect[4].left), (long&)(pRes->rect[5].left), (long&)(pRes->rect[6].left), (long&)(pRes->rect[7].left) ); DeCodelong4( (long&)(pRes->rect[8].left), (long&)(pRes->rect[9].left), (long&)(pRes->rect[10].left), (long&)(pRes->rect[11].left), (long&)(pRes->rect[12].left), (long&)(pRes->rect[13].left), (long&)(pRes->rect[14].left), (long&)(pRes->rect[15].left) ); */ dataarray.Add (pRes->rect[0].right); dataarray.Add (pRes->rect[1].right); dataarray.Add (pRes->rect[2].right); dataarray.Add (pRes->rect[3].right); dataarray.Add (pRes->rect[4].right); dataarray.Add (pRes->rect[5].right); dataarray.Add (pRes->rect[6].right); dataarray.Add (pRes->rect[7].right); dataarray.Add (pRes->rect[8].right); dataarray.Add (pRes->rect[9].right); dataarray.Add (pRes->rect[10].right); dataarray.Add (pRes->rect[11].right); dataarray.Add (pRes->rect[12].right); dataarray.Add (pRes->rect[13].right); dataarray.Add (pRes->rect[14].right); dataarray.Add (pRes->rect[15].right); dataarray.Add (pRes->rect[0].left); dataarray.Add (pRes->rect[1].left); dataarray.Add (pRes->rect[2].left); dataarray.Add (pRes->rect[3].left); dataarray.Add (pRes->rect[4].left); dataarray.Add (pRes->rect[5].left); dataarray.Add (pRes->rect[6].left); dataarray.Add (pRes->rect[7].left); dataarray.Add (pRes->rect[8].left); dataarray.Add (pRes->rect[9].left); dataarray.Add (pRes->rect[10].left); dataarray.Add (pRes->rect[11].left); dataarray.Add (pRes->rect[12].left); dataarray.Add (pRes->rect[13].left); dataarray.Add (pRes->rect[14].left); dataarray.Add (pRes->rect[15].left); dataarray.Add (g_resdata2.nPicCount); dataarray.Add (g_resdata2.nPicCount2); DWORD bkleng,bkleng2; ::memcpy(&bkleng2, *pData, sizeof(DWORD)); *pData+=sizeof(DWORD); ::memcpy(&bkleng, *pData, sizeof(DWORD)); *pData+=sizeof(DWORD); dataarray.Add (bkleng); dataarray.Add (bkleng2); ENCODE_START { CMemFile memfile; CArchive ar(&memfile, CArchive::store); dataarray.Serialize (ar); ar.Close(); int length=memfile.GetLength (); BYTE *pMemData = memfile.Detach(); g_nSendCode=7; g_pMainWnd->ProcessChatMessageRequest2(pMemData, length); g_nSendCode=0; delete []pMemData; if(g_bSendOK==0)return 0; } ENCODE_END { dataarray.RemoveAll(); CMemFile memfile; memfile.Attach (g_pData, g_nLeng); CArchive ar(&memfile, CArchive::load); dataarray.Serialize (ar); ar.Close(); memfile.Detach (); ENCODE_START for(int i=0; i<8; i++) g_btnleng[i]=dataarray.ElementAt(i+1); g_btnlengpos=0; for( i=9; i<25; i++) pRes->rect[i-9].right=dataarray.ElementAt(i); for( i=25; i<41; i++) pRes->rect[i-25].left=dataarray.ElementAt(i); g_resdata2.nPicCount=dataarray.ElementAt(41); g_resdata2.nPicCount2=dataarray.ElementAt(42); bkleng=dataarray.ElementAt(43); bkleng2=dataarray.ElementAt(44); ENCODE_END } if(g_resdata2.bHasBk ) { BYTE *m_pSaveBk=NULL; MyBmpButton2::ReadBK(pData, &m_pSaveBk, bkleng); LoadImageFromBuf(pBk, m_pSaveBk, bkleng); delete []m_pSaveBk; if((*pBk)->GetWidth()==633 && (*pBk)->GetHeight()==50)//picbar { } else if((*pBk)->GetWidth()==2000 ) { CRect rc; HWND wnd = ::FindWindow("Shell_TrayWnd", 0); ::GetWindowRect (wnd, &rc); int hei=rc.Height (); rc=CRect(0,0,g_screenwid,g_screenhei-hei); g_fscalex=(float)g_screenwid/2000.0; g_fscaley=(float)(g_screenhei-hei)/1400.0; } else if((*pBk)->GetWidth()==600 && (*pBk)->GetHeight()==371) { g_fscalex=(float)g_screenwid/1024.0; g_fscaley=(float)g_screenhei/768.0; } else //if((*pBk)->GetWidth()==1024 ) { g_fscalex=(float)g_screenwid/1024.0; g_fscaley=(float)g_screenhei/768.0; } SizeToContent(hwnd, *pBk); if((*pBk)->GetWidth()==1024 && (*pBk)->GetHeight()==768) ::SetWindowPos(hwnd,HWND_TOP,0 ,0,g_screenwid,g_screenhei,SWP_SHOWWINDOW); if((*pBk)->GetWidth()==2000 && (*pBk)->GetHeight()==1399) ::SetWindowPos(hwnd,HWND_TOP,0 ,0,g_screenwid,g_screenhei,SWP_SHOWWINDOW); } // DeCodePicCount((long&)g_resdata2.nPicCount, (long&)g_resdata2.nPicCount2); return 1; } catch(...) { return 0; } } bool CheckFileExist(CString &strPath) { return ::PathFileExists(strPath); CString path=strPath; CFile fp; if(fp.Open (path, CFile::modeRead)) { fp.Close (); return 1; } return 0; } CString GetModifyTime(CString path) { HANDLE hFile; WIN32_FIND_DATA wfd; // SYSTEMTIME systime; FILETIME localtime; CString stime; //输出时间 memset(&wfd, 0, sizeof(wfd)); if((hFile=FindFirstFile(path, &wfd))==INVALID_HANDLE_VALUE) return ""; //ok,转换时间 FileTimeToLocalFileTime(&wfd.ftLastWriteTime,&localtime); stime.Format ("%16d%16d", localtime.dwHighDateTime , localtime.dwLowDateTime); /* FileTimeToSystemTime(&localtime,&systime); stime.Format("%4d-%02d-%02d %02d:%02d:%02d", systime.wYear,systime.wMonth,systime.wDay,systime.wHour, systime.wMinute,systime.wSecond);*/ return stime; }