// ShowPic3.cpp : implementation file // #include "stdafx.h" #include "dbserver.h" #include "ShowPic3.h" #include "./helper/ffsco.h" #include "DelPhotoSet.h" #include <process.h> #include "Lzari.h" #include "mysqldata.h" #define THUMBNAIL_WIDTH 100 #define THUMBNAIL_HEIGHT 90 #include "ConnectThread.h" #include "ShowPhoto.h" ///////////////////////////////////////////////////////////////////////////// // ShowPic3 dialog IDC_BU IDC_COMBO2 ShowPic3::ShowPic3(CWnd* pParent /*=NULL*/) : CDialog(ShowPic3::IDD, pParent) { //{{AFX_DATA_INIT(ShowPic3) m_check1 = 1; //}}AFX_DATA_INIT m_bTerminate = false; m_bRunning = false; m_hThread = NULL; } void ShowPic3::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(ShowPic3) DDX_Control(pDX, IDC_COMBO1, m_combo1); DDX_Control(pDX, IDC_LIST2, m_List2); DDX_Control(pDX, IDC_LIST1, m_List1); DDX_Check(pDX, IDC_CHECK1, m_check1); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(ShowPic3, CDialog) //{{AFX_MSG_MAP(ShowPic3) ON_NOTIFY(NM_DBLCLK, IDC_LIST1, OnDblclkList1) ON_WM_DESTROY() ON_BN_CLICKED(IDC_BUTdelall, OnBUTdelall) ON_BN_CLICKED(IDC_BUTdel, OnBUTdel) ON_LBN_SELCHANGE(IDC_LIST2, OnSelchangeList2) ON_BN_CLICKED(IDC_BTNshow1, OnBTNshow1) ON_BN_CLICKED(IDC_BTNshow2, OnBTNshow2) ON_BN_CLICKED(IDC_BTNshow3, OnBTNshow3) ON_BN_CLICKED(IDC_BTNshow4, OnBTNshow4) ON_BN_CLICKED(IDC_BUTdel1, OnBUTdel1) ON_BN_CLICKED(IDC_BUTdel2, OnBUTdel2) ON_BN_CLICKED(IDC_BUTdel3, OnBUTdel3) ON_BN_CLICKED(IDC_BUTdel4, OnBUTdel4) ON_WM_CTLCOLOR() ON_CBN_SELCHANGE(IDC_COMBO1, OnSelchangeCombo1) //}}AFX_MSG_MAP END_MESSAGE_MAP() /* void DataToArray(CArray<CStringArray, CStringArray>*List1array, BYTE code, BYTE *g_pData, int g_nLeng) { try { List1array->RemoveAll (); if(g_nLeng==0)return; if(code) { BYTE *lpszOut = NULL; int nOutSize = 0; LZARI Lzari; Lzari.UnCompress(g_pData,g_nLeng,lpszOut,nOutSize); CMemFile memfile; memfile.Attach (lpszOut,nOutSize); Lzari.Release(); CArchive ar(&memfile, CArchive::load); List1array->SetSize(g_sendhead.count[0]); for(int ii=0; ii<List1array->GetSize (); ii++) { List1array->ElementAt (ii).Serialize (ar); } ar.Close(); memfile.Detach (); } else { CMemFile memfile; memfile.Attach (g_pData,g_nLeng); CArchive ar(&memfile, CArchive::load); List1array->SetSize(g_sendhead.count[0]); for(int ii=0; ii<List1array->GetSize (); ii++) { List1array->ElementAt (ii).Serialize (ar); } ar.Close(); memfile.Detach (); } } catch(...) { } }*/ ///////////////////////////////////////////////////////////////////////////// // ShowPic3 message handlers extern int FindArray(CStringArray *pArray, CString Str); extern void GetPathFromNetShareName(CString name, CString &sRet); BOOL ShowPic3::OnInitDialog() { CDialog::OnInitDialog(); CString str = "\r\n 1. ����Ӳ��Ҫ��ԭ����Ӳ��ҪΪ2�����Ӳ��(������ͬһ��Ӳ������������)��\r\n\ 2. ����Ӳ��������Ը���һ���µı���Ӳ��(����������������Ƿ��ۼ�����ϵ)\r\n\ 3. ����Ӳ����������ļ��������ڴ�ǰ�����˳��̽����̺�ɾ��\r\n\ 4. �粻��Ҫ���汸�ݣ������ڹ���������Ƭ���ֹ�ɾ������"; GetDlgItem(IDC_STATIC1)->SetWindowText(str); m_combo1.AddString("ȫ��"); m_combo1.AddString("ȡ���1����"); m_combo1.AddString("ȡ���2����"); m_combo1.AddString("ȡ���3����"); m_combo1.AddString("ȡ���6����"); m_combo1.AddString("ȡ���9����"); m_combo1.AddString("ȡ���12����"); m_combo1.AddString("ȡ���18����"); m_combo1.AddString("ȡ���24����"); m_combo1.AddString("ȡ���36����"); m_combo1.SetCurSel(0); CRect rc, rc2; GetWindowRect(rc2); DEVMODE g_dm; g_dm.dmSize = sizeof(DEVMODE); EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &g_dm); int wid = g_dm.dmPelsWidth * 3 / 4; int hei = g_dm.dmPelsHeight * 3 / 4; ::MoveWindow(m_hWnd, 0, 0, wid, hei, TRUE); CenterWindow(); GetClientRect(rc); GetDlgItem(IDC_STATIC1)->GetWindowRect(rc2); ScreenToClient(rc2); rc2.left = 0; rc2.right = rc.right; GetDlgItem(IDC_STATIC1)->MoveWindow(rc2); GetDlgItem(IDC_STATIC2)->MoveWindow(rc2); m_List2.GetWindowRect(rc2); ScreenToClient(rc2); int dt = rc2.left; rc2.bottom = rc.bottom - dt; m_List2.MoveWindow(rc2); m_List1.GetWindowRect(rc2); ScreenToClient(rc2); rc2.bottom = rc.bottom - dt; rc2.right = rc.right - dt; m_List1.MoveWindow(rc2); /* CConnectSocket consock; consock.m_pConndb =&g_db; BYTE code=217; DWORD length,arraysize; BYTE *pReturn=NULL; consock.GetDataFromCode(code, &pReturn, length, arraysize, ""); DataToArray(&m_List1array, code, pReturn, length);delete []pReturn;*/ { m_List1array.RemoveAll(); CArray<CDatabase*, CDatabase*>dbarraytemp; dbarraytemp.Copy(g_dbHistoryArray); dbarraytemp.InsertAt(0, &g_db); for (int a = dbarraytemp.GetSize() - 1; a >= 0; a--) { CString filter = "status3='OK'"; CDatabase *m_pConndb = dbarraytemp.ElementAt(a); CRecordset myset(m_pConndb); CString sql = "select count(*) as cot from dindan"; if (!filter.IsEmpty())sql += " where " + filter; myset.Open(CRecordset::forwardOnly, sql); myset.GetFieldValue("cot", sql); myset.Close(); int count = atol(sql); sql.Format("%d", a - 1); // if(a==0)sql="-1"; int oldsize = m_List1array.GetSize(); m_List1array.SetSize(oldsize + count, 1); CRstDindanForm rsSt; rsSt.m_pDatabase = m_pConndb; if (!filter.IsEmpty())rsSt.m_strFilter = filter; rsSt.m_strSort = "id"; rsSt.Open(); int ii = 0; while (!rsSt.IsEOF()) { m_List1array.ElementAt(oldsize + ii).RemoveAll(); m_List1array.ElementAt(oldsize + ii).Add(rsSt.id); m_List1array.ElementAt(oldsize + ii).Add(rsSt.name1); m_List1array.ElementAt(oldsize + ii).Add(rsSt.name2); /* m_List1array.ElementAt (oldsize+ii).Add(rsSt.txtype) ; m_List1array.ElementAt (oldsize+ii).Add(rsSt.discount) ; m_List1array.ElementAt (oldsize+ii).Add(rsSt.authorize) ; m_List1array.ElementAt (oldsize+ii).Add(rsSt.discount2) ; m_List1array.ElementAt (oldsize+ii).Add(rsSt.authorize2) ; m_List1array.ElementAt (oldsize+ii).Add(rsSt.status) ; m_List1array.ElementAt (oldsize+ii).Add(rsSt.status4) ; m_List1array.ElementAt (oldsize+ii).Add(rsSt.status2) ; m_List1array.ElementAt (oldsize+ii).Add(rsSt.status6) ; m_List1array.ElementAt (oldsize+ii).Add(rsSt.status5) ; m_List1array.ElementAt (oldsize+ii).Add(rsSt.status8) ; m_List1array.ElementAt (oldsize+ii).Add(rsSt.status3) ; m_List1array.ElementAt (oldsize+ii).Add(rsSt.time1) ; m_List1array.ElementAt (oldsize+ii).Add(rsSt.time2) ; m_List1array.ElementAt (oldsize+ii).Add(rsSt.time4) ; m_List1array.ElementAt (oldsize+ii).Add(rsSt.time6) ;*/ m_List1array.ElementAt(oldsize + ii).Add(rsSt.time5); /* m_List1array.ElementAt (oldsize+ii).Add(rsSt.ren) ; m_List1array.ElementAt (oldsize+ii).Add(rsSt.taoxiname) ; m_List1array.ElementAt (oldsize+ii).Add(rsSt.taoxijiage) ; m_List1array.ElementAt (oldsize+ii).Add(rsSt.waiter1) ; m_List1array.ElementAt (oldsize+ii).Add(rsSt.waiter2) ; m_List1array.ElementAt (oldsize+ii).Add(rsSt.waiter5) ; m_List1array.ElementAt (oldsize+ii).Add(rsSt.waiter3) ; m_List1array.ElementAt (oldsize+ii).Add(rsSt.waiter7) ; m_List1array.ElementAt (oldsize+ii).Add(rsSt.waiter4) ; m_List1array.ElementAt (oldsize+ii).Add(rsSt.waiter8) ; m_List1array.ElementAt (oldsize+ii).Add(rsSt.waiter6) ; m_List1array.ElementAt (oldsize+ii).Add(rsSt.phone1) ; m_List1array.ElementAt (oldsize+ii).Add(rsSt.phone2) ; m_List1array.ElementAt (oldsize+ii).Add(rsSt.pinyin1) ; m_List1array.ElementAt (oldsize+ii).Add(rsSt.pinyin2) ; m_List1array.ElementAt (oldsize+ii).Add(sql) ;*/ ii++; rsSt.MoveNext(); if (m_List1array.GetSize() <= (oldsize + ii))break; } rsSt.Close(); m_List1array.SetSize(oldsize + ii, 1); } } { CRstversion rsSt; rsSt.m_pDatabase = &g_db; rsSt.Open(); if (!rsSt.IsEOF()) { g_path1 = rsSt.m_bakserver1; g_path2 = rsSt.m_bakserver2; g_path4 = rsSt.m_bakserver3; g_path3 = rsSt.m_bakserver4; } rsSt.Close(); } #ifdef CHILD_VERSION if(g_path1.Find(":")==-1&& g_path1!="") g_path1="\\\\"+g_path1+"\\�ͻ�ԭƬ����(��ͯ��������)$"; if(1)//(localname.CompareNoCase (g_path1)==0 || CompareIP(localname, g_path1)==0) && CheckFolderFileExist("\\\\"+g_path1+"\\�ͻ�ԭƬ����(��ͯ��������)$")) GetPathFromNetShareName("�ͻ�ԭƬ����(��ͯ��������)$", g_path1); if(g_path2.Find(":")==-1&& g_path2!="") g_path2="\\\\"+g_path2+"\\�õ�Ƭ����(��ͯ��������)$"; if(1)//((localname.CompareNoCase (g_path2)==0 || CompareIP(localname, g_path2)==0) && CheckFolderFileExist("\\\\"+g_path1+"\\�õ�Ƭ����(��ͯ��������)$")) GetPathFromNetShareName("�õ�Ƭ����(��ͯ��������)$", g_path2); if(g_path4.Find(":")==-1&& g_path4!="") g_path4="\\\\"+g_path4+"\\���õ�Ƭ����(��ͯ��������)$"; if(1)//((localname.CompareNoCase (g_path4)==0 || CompareIP(localname, g_path4)==0) && CheckFolderFileExist("\\\\"+g_path1+"\\���õ�Ƭ����(��ͯ��������)$")) GetPathFromNetShareName("���õ�Ƭ����(��ͯ��������)$", g_path4); if(g_path3.Find(":")==-1&& g_path3!="") g_path3="\\\\"+g_path3+"\\��ƺõ�Ƭ����(��ͯ��������)$"; if(1)//((localname.CompareNoCase (g_path3)==0 || CompareIP(localname, g_path3)==0) && CheckFolderFileExist("\\\\"+g_path1+"\\��ƺõ�Ƭ����(��ͯ��������)$")) GetPathFromNetShareName("��ƺõ�Ƭ����(��ͯ��������)$", g_path3); #else if (g_path1.Find(":") == -1 && g_path1 != "") g_path1 = "\\\\" + g_path1 + "\\�ͻ�ԭƬ����(��������)$"; if (1)//((localname.CompareNoCase (g_path1)==0 || CompareIP(localname, g_path1)==0) && CheckFolderFileExist("\\\\"+g_path1+"\\�ͻ�ԭƬ����(��������)$")) GetPathFromNetShareName("�ͻ�ԭƬ����(��������)$", g_path1); if (g_path2.Find(":") == -1 && g_path2 != "") g_path2 = "\\\\" + g_path2 + "\\�õ�Ƭ����(��������)$"; if (1)//((localname.CompareNoCase (g_path2)==0 || CompareIP(localname, g_path2)==0) && CheckFolderFileExist("\\\\"+g_path1+"\\�õ�Ƭ����(��������)$")) GetPathFromNetShareName("�õ�Ƭ����(��������)$", g_path2); if (g_path4.Find(":") == -1 && g_path4 != "") g_path4 = "\\\\" + g_path4 + "\\���õ�Ƭ����(��������)$"; if (1)//((localname.CompareNoCase (g_path4)==0 || CompareIP(localname, g_path4)==0) && CheckFolderFileExist("\\\\"+g_path1+"\\���õ�Ƭ����(��������)$")) GetPathFromNetShareName("���õ�Ƭ����(��������)$", g_path4); if (g_path3.Find(":") == -1 && g_path3 != "") g_path3 = "\\\\" + g_path3 + "\\��ƺõ�Ƭ����(��������)$"; if (1)//((localname.CompareNoCase (g_path3)==0 || CompareIP(localname, g_path3)==0) && CheckFolderFileExist("\\\\"+g_path1+"\\��ƺõ�Ƭ����(��������)$")) GetPathFromNetShareName("��ƺõ�Ƭ����(��������)$", g_path3); #endif LoadPhotos(); for (int i = 0; i < m_List1array.GetSize(); i++) { str = m_List1array.ElementAt(i).ElementAt(0); if (FindArray(&m_dirarray1, str) == -1) { if (FindArray(&m_dirarray2, str) == -1) { if (FindArray(&m_dirarray3, str) == -1) { if (FindArray(&m_dirarray4, str) == -1) { continue; } } } } str += "\r\n"; str += m_List1array.ElementAt(i).ElementAt(1); str += m_List1array.ElementAt(i).ElementAt(2); if (m_List2.GetCount() % 2) m_List2.AddEntry(str, RGB(204, 204, 204), m_List2.GetCount()); else m_List2.AddEntry(str, RGB(190, 190, 190), m_List2.GetCount()); m_idarray.Add(str); m_datearray.Add(m_List1array.ElementAt(i).ElementAt(3)); } m_List2.Invalidate(); m_ImageListThumb.Create(THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT, ILC_COLOR24, 0, 1); m_List1.SetImageList(&m_ImageListThumb, LVSIL_NORMAL); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } extern void LoadImageFromFile(Image **img, CString path); extern void LoadImageFromBuf(Image **img, CString path); int GetOrientation(Image *image) { try { if (image) { UINT totalBufferSize; UINT numProperties; image->GetPropertySize(&totalBufferSize, &numProperties); // Allocate the buffer that will receive the property items. PropertyItem* pAllItems = (PropertyItem*)malloc(totalBufferSize); // Fill the buffer. image->GetAllPropertyItems(totalBufferSize, numProperties, pAllItems); // Print the id data member of each property item. for (UINT j = 0; j < numProperties; ++j) { if (PropertyTagOrientation == pAllItems[j].id) { short* ptrLong = (short*)(pAllItems[j].value); int ret = (int)*ptrLong; free(pAllItems); return ret; } } free(pAllItems); } } catch (...) { } return 1; } unsigned __stdcall LoadThumbNail20(LPVOID lpParam) { try { ShowPic3 *pDlg = (ShowPic3*)lpParam; CListCtrl *ListCtrl = &pDlg->m_List1; CImageList* pImgList = &pDlg->m_ImageListThumb; // reset our image list for (int i = 0; i < pImgList->GetImageCount(); i++) pImgList->Remove(i); // remove all items from list view ListCtrl->DeleteAllItems(); pImgList->SetImageCount(pDlg->m_vFileName.size()); TCHAR path[MAX_PATH]; vector<CString>::iterator iter; // Set redraw to FALSE to avoid flickering during adding new items ListCtrl->SetRedraw(FALSE); int nIndex = 0; CString str, spath; for (iter = pDlg->m_vFileName.begin(); iter != pDlg->m_vFileName.end() && pDlg->m_bTerminate != true; iter++, nIndex++) { str = *iter; spath.Empty(); if (str.Left(str.ReverseFind('\\') + 1) != pDlg->m_path) { spath = str.Left(str.ReverseFind('\\') + 1); spath = spath.Right(spath.GetLength() - pDlg->m_path.GetLength()); } str = str.Right(str.GetLength() - str.ReverseFind('\\') - 1); str = spath + str.Left(str.GetLength() - 4); ListCtrl->InsertItem(nIndex, str, nIndex); } ListCtrl->SetRedraw(TRUE); ListCtrl->Invalidate(); const float fRatio = (float)THUMBNAIL_HEIGHT / THUMBNAIL_WIDTH; int XDest, YDest, nDestWidth, nDestHeight; nIndex = 0; SolidBrush whitebrush(Color(255, 255, 255, 255)); for (iter = pDlg->m_vFileName.begin(); iter != pDlg->m_vFileName.end() && pDlg->m_bTerminate != true; iter++, nIndex++) { // Load Image File Image *image = NULL; Bitmap *pBmp = NULL; str = *iter; spath = str.Left(str.ReverseFind('\\') + 1); spath += "s"; spath += str.Right(str.GetLength() - str.ReverseFind('\\') - 1); if (::CheckFileExist(spath)) ::LoadImageFromBuf(&image, spath); else { str.MakeLower(); if (str.Right(3) != "jpg")continue; ::LoadImageFromBuf(&image, str); } if (image == NULL)continue; int orientation = GetOrientation(image); if (orientation == 8) image->RotateFlip(Rotate270FlipNone); else if (orientation == 6) image->RotateFlip(Rotate90FlipNone); if (image->GetWidth() == 0) continue; // Calculate Rect to fit to canvas const float fImgRatio = (float)image->GetHeight() / image->GetWidth(); if (fImgRatio > fRatio) { nDestWidth = THUMBNAIL_HEIGHT / fImgRatio; XDest = (THUMBNAIL_WIDTH - nDestWidth) / 2; YDest = 0; nDestHeight = THUMBNAIL_HEIGHT; } else { XDest = 0; nDestWidth = THUMBNAIL_WIDTH; nDestHeight = THUMBNAIL_WIDTH*fImgRatio; YDest = (THUMBNAIL_HEIGHT - nDestHeight) / 2; } pBmp = new Bitmap(THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT, PixelFormat24bppRGB); Graphics graph2(pBmp); graph2.Clear(Color(255, 192, 192, 192)); graph2.FillRectangle(&whitebrush, 1, 1, THUMBNAIL_WIDTH - 2, THUMBNAIL_HEIGHT - 2); Graphics graph(pBmp); Rect desRect(XDest, YDest, nDestWidth, nDestHeight); // Draw Image graph.DrawImage(image, desRect, 0, 0, image->GetWidth(), image->GetHeight(), UnitPixel); delete image; // Attach to Bitmap and Replace image in CImageList CBitmap bitmap; HBITMAP hbmp; pBmp->GetHBITMAP(Color(255, 255, 255, 255), &hbmp); bitmap.Attach(hbmp); pImgList->Replace(nIndex, &bitmap, NULL); delete pBmp; // Redraw only a current item for removing flickering and fast speed. ListCtrl->RedrawItems(nIndex, nIndex); // Release used DC and Object } ListCtrl->Invalidate(); pDlg->m_bRunning = false; pDlg->m_bTerminate = false; _endthreadex(0); return 0; } catch (...) { } } void ShowPic3::LoadThumbImages() { TerminateThread(); m_hThread = (HANDLE)_beginthreadex(NULL, 0, LoadThumbNail20, (LPVOID)this, 0/* CREATE_SUSPENDED*/, &m_dwThreadID); m_bRunning = true; } BOOL ShowPic3::TerminateThread() { if (!m_bRunning) return TRUE; m_bTerminate = true; for (;;) { if (::WaitForSingleObject(m_hThread, 0) == WAIT_OBJECT_0) break; MSG msg; while (::PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) { if (!AfxGetApp()->PumpMessage()) break; } } ::CloseHandle(m_hThread); return TRUE; } extern void LoadImageFromBuf(Image **img, CString path); void ShowPic3::OnDblclkList1(NMHDR* pNMHDR, LRESULT* pResult) { // TODO: Add your control notification handler code here POSITION pos; pos = m_List1.GetFirstSelectedItemPosition(); if (pos == NULL) { return; } int iItem = m_List1.GetNextSelectedItem(pos); Image *m_pImg = NULL; ::LoadImageFromBuf(&m_pImg, m_patharray1.ElementAt(iItem)); ShowPhoto dlg; dlg.m_pImg = m_pImg; dlg.DoModal(); delete m_pImg; /* ShowPic22 dlg; dlg.m_pos=iItem; dlg.m_pPathArray=&m_patharray1; dlg.DoModal ();*/ *pResult = 0; } void ShowPic3::OnDestroy() { TerminateThread(); CDialog::OnDestroy(); // TODO: Add your message handler code here } extern BOOL myisdigit(CString str); void ShowPic3::LoadPhotos() { if (g_path1 == "")return; CString str; if (1) { using namespace helper_coffs; ffsco o; o.dirs(0); o.find(LPCSTR(g_path1), LPCSTR("*.*")); ffsco::typeT coo; ffsco::typeT::iterator it; coo = o.co_dir(); for (it = coo.begin(); coo.end() != it; it++) { str = (*it).c_str(); if (str == g_path1 + "\\")continue; str.TrimRight("\\"); str = str.Right(str.GetLength() - str.ReverseFind('\\') - 1); m_dirarray1.Add(str); } } } void ShowPic3::OnBUTdel() { DelPhotoSet dlg; dlg.DoModal(); } void ShowPic3::OnSelchangeList2() { // TODO: Add your control notification handler code here UpdateData(); int pos = m_List2.GetCurSel(); if (pos == -1)return; CString str; m_List2.GetText(pos, str); pos = str.Find("\r\n"); if (pos == -1)return;; m_id = str.Left(pos); ShowPhoto1(); if (m_patharray1.GetSize() == 0)OnBTNshow2(); if (m_patharray1.GetSize() == 0)OnBTNshow3(); if (m_patharray1.GetSize() == 0)OnBTNshow4(); } void ShowPic3::ShowPhoto1() { if (m_id == "") { AfxMessageBox("����ѡ�п���!", MB_ICONINFORMATION); return; } CString str; m_path = g_path1 + "\\" + m_id + "\\"; m_patharray1.RemoveAll(); if (1) { using namespace helper_coffs; ffsco o; o.dirs(1); o.find(LPCSTR(m_path), LPCSTR("*.jpg")); ffsco::typeT coo; ffsco::typeT::iterator it; coo = o.co_file(); for (it = coo.begin(); coo.end() != it; it++) { str = (*it).c_str(); if (str.GetAt(str.ReverseFind('\\') + 1) == 's')continue; if (str.GetAt(str.ReverseFind('\\') + 1) == 'm')continue; str.MakeLower(); m_patharray1.Add(str); } } if (m_bRunning)return; CStringArray *pArray = &m_patharray1; m_vFileName.clear(); for (int i = 0; i < pArray->GetSize(); i++) { CString filePath = pArray->ElementAt(i); filePath.MakeLower(); m_vFileName.push_back(filePath); } LoadThumbImages(); } void ShowPic3::ShowPhoto2() { if (m_id == "") { AfxMessageBox("����ѡ�п���!", MB_ICONINFORMATION); return; } CString str; m_path = g_path2 + "\\" + m_id + "\\"; m_patharray1.RemoveAll(); if (1) { using namespace helper_coffs; ffsco o; o.dirs(1); o.find(LPCSTR(m_path), LPCSTR("*.jpg")); ffsco::typeT coo; ffsco::typeT::iterator it; coo = o.co_file(); for (it = coo.begin(); coo.end() != it; it++) { str = (*it).c_str(); if (str.GetAt(str.ReverseFind('\\') + 1) == 's')continue; if (str.GetAt(str.ReverseFind('\\') + 1) == 'm')continue; str.MakeLower(); m_patharray1.Add(str); } } if (m_bRunning)return; CStringArray *pArray = &m_patharray1; m_vFileName.clear(); for (int i = 0; i < pArray->GetSize(); i++) { CString filePath = pArray->ElementAt(i); filePath.MakeLower(); m_vFileName.push_back(filePath); } LoadThumbImages(); } void ShowPic3::ShowPhoto3() { if (m_id == "") { AfxMessageBox("����ѡ�п���!", MB_ICONINFORMATION); return; } CString str; m_path = g_path3 + "\\" + m_id + "\\"; m_patharray1.RemoveAll(); if (1) { using namespace helper_coffs; ffsco o; o.dirs(1); o.find(LPCSTR(m_path), LPCSTR("*.jpg")); ffsco::typeT coo; ffsco::typeT::iterator it; coo = o.co_file(); for (it = coo.begin(); coo.end() != it; it++) { str = (*it).c_str(); if (str.GetAt(str.ReverseFind('\\') + 1) == 's')continue; if (str.GetAt(str.ReverseFind('\\') + 1) == 'm')continue; str.MakeLower(); m_patharray1.Add(str); } } if (m_bRunning)return; CStringArray *pArray = &m_patharray1; m_vFileName.clear(); for (int i = 0; i < pArray->GetSize(); i++) { CString filePath = pArray->ElementAt(i); filePath.MakeLower(); m_vFileName.push_back(filePath); } LoadThumbImages(); } void ShowPic3::ShowPhoto4() { if (m_id == "") { AfxMessageBox("����ѡ�п���!", MB_ICONINFORMATION); return; } CString str; m_path = g_path4 + "\\" + m_id + "\\"; m_patharray1.RemoveAll(); if (1) { using namespace helper_coffs; ffsco o; o.dirs(1); o.find(LPCSTR(m_path), LPCSTR("*.jpg")); ffsco::typeT coo; ffsco::typeT::iterator it; coo = o.co_file(); for (it = coo.begin(); coo.end() != it; it++) { str = (*it).c_str(); if (str.GetAt(str.ReverseFind('\\') + 1) == 's')continue; if (str.GetAt(str.ReverseFind('\\') + 1) == 'm')continue; str.MakeLower(); m_patharray1.Add(str); } } if (m_bRunning)return; CStringArray *pArray = &m_patharray1; m_vFileName.clear(); for (int i = 0; i < pArray->GetSize(); i++) { CString filePath = pArray->ElementAt(i); filePath.MakeLower(); m_vFileName.push_back(filePath); } LoadThumbImages(); } void ShowPic3::OnBTNshow1() { // TODO: Add your control notification handler code here ShowPhoto1(); } void ShowPic3::OnBTNshow2() { // TODO: Add your control notification handler code here ShowPhoto2(); } void ShowPic3::OnBTNshow3() { // TODO: Add your control notification handler code here ShowPhoto4(); } void ShowPic3::OnBTNshow4() { // TODO: Add your control notification handler code here ShowPhoto3(); } void ShowPic3::OnBUTdelall() { // TODO: Add your control notification handler code here if (m_id == "") { AfxMessageBox("����ѡ����Ҫɾ���Ŀ���!", MB_ICONINFORMATION); return; } if (AfxMessageBox("ɾ�������ָ�, ȷ��ɾ����?", MB_YESNO | MB_ICONSTOP) != IDYES)return; DeleteDirectory(g_path1 + "\\" + m_id + "\\"); DeleteDirectory(g_path2 + "\\" + m_id + "\\"); DeleteDirectory(g_path3 + "\\" + m_id + "\\"); DeleteDirectory(g_path4 + "\\" + m_id + "\\"); OnBTNshow1(); } void ShowPic3::OnBUTdel1() { // TODO: Add your control notification handler code here if (m_id == "") { AfxMessageBox("����ѡ����Ҫɾ���Ŀ���!", MB_ICONINFORMATION); return; } if (AfxMessageBox("ɾ�������ָ�, ȷ��ɾ����?", MB_YESNO | MB_ICONSTOP) != IDYES)return; DeleteDirectory(g_path1 + "\\" + m_id + "\\"); OnBTNshow1(); } void ShowPic3::OnBUTdel2() { // TODO: Add your control notification handler code here if (m_id == "") { AfxMessageBox("����ѡ����Ҫɾ���Ŀ���!", MB_ICONINFORMATION); return; } if (AfxMessageBox("ɾ�������ָ�, ȷ��ɾ����?", MB_YESNO | MB_ICONSTOP) != IDYES)return; DeleteDirectory(g_path2 + "\\" + m_id + "\\"); OnBTNshow2(); } void ShowPic3::OnBUTdel3() { // TODO: Add your control notification handler code here if (m_id == "") { AfxMessageBox("����ѡ����Ҫɾ���Ŀ���!", MB_ICONINFORMATION); return; } if (AfxMessageBox("ɾ�������ָ�, ȷ��ɾ����?", MB_YESNO | MB_ICONSTOP) != IDYES)return; DeleteDirectory(g_path4 + "\\" + m_id + "\\"); OnBTNshow3(); } void ShowPic3::OnBUTdel4() { // TODO: Add your control notification handler code here if (m_id == "") { AfxMessageBox("����ѡ����Ҫɾ���Ŀ���!", MB_ICONINFORMATION); return; } if (AfxMessageBox("ɾ�������ָ�, ȷ��ɾ����?", MB_YESNO | MB_ICONSTOP) != IDYES)return; DeleteDirectory(g_path3 + "\\" + m_id + "\\"); OnBTNshow4(); } HBRUSH ShowPic3::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) { HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor); // TODO: Change any attributes of the DC here if (nCtlColor == CTLCOLOR_STATIC && pWnd->GetDlgCtrlID() == IDC_STATIC1) { pDC->SetBkMode(TRANSPARENT); //�������屳��Ϊ�� return (HBRUSH)::GetStockObject(WHITE_BRUSH); // ���ñ���ɫ } // TODO: Return a different brush if the default is not desired return hbr; } void ShowPic3::OnSelchangeCombo1() { // TODO: Add your control notification handler code here int pos = m_combo1.GetCurSel(); if (pos != -1) { CString str; m_combo1.GetLBText(pos, str); int days = -1; if (str == "ȫ��")days = -1; else if (str == "ȡ���1����")days = 31; else if (str == "ȡ���2����")days = 31 + 30; else if (str == "ȡ���3����")days = 31 * 2 + 30; else if (str == "ȡ���6����")days = 31 * 3 + 30 * 3; else if (str == "ȡ���9����")days = 31 * 5 + 30 * 4; else if (str == "ȡ���12����")days = 365; else if (str == "ȡ���18����")days = 365 + 31 * 3 + 30 * 3; else if (str == "ȡ���24����")days = 365 * 2; else if (str == "ȡ���36����")days = 365 * 3; m_List2.ResetContent(); CString date; CTime today = CTime::GetCurrentTime(); CTimeSpan dt; for (int i = 0; i < m_datearray.GetSize(); i++) { date = m_datearray.ElementAt(i); // MessageBox(date); CTime tm = GetTmFromStr(date); dt = today - tm; // str.Format("%d", dt.GetDays()); // MessageBox(str); if (days != -1 && dt.GetDays() < days)continue; str = m_idarray.ElementAt(i); if (m_List2.GetCount() % 2) m_List2.AddEntry(str, RGB(204, 204, 204), m_List2.GetCount()); else m_List2.AddEntry(str, RGB(190, 190, 190), m_List2.GetCount()); } m_List2.Invalidate(); } }