1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071 |
- // ShowPic.cpp : implementation file
- //
- #include "stdafx.h"
- #include "ylgl.h"
- #include "ShowPic.h"
- #include "ShowPic22.h"
- #include "ImportPhoto.h"
- #include "JPEG.h"
- #include "MyLock.h"
- #include "ZipTypeDlg.h"
- #include "SetDesignNo.h"
- #include "NetShareInfo.h"
- #define THUMBNAIL_WIDTH 100
- #define THUMBNAIL_HEIGHT 90
- ThreadSection ShowPic::m_ThreadSection;
- unsigned __stdcall RefreshWork(LPVOID lpParam);
- /////////////////////////////////////////////////////////////////////////////
- // ShowPic dialog IDC_BU IDC_COMBO2
- ShowPic::ShowPic(CWnd* pParent /*=NULL*/): CDialog(ShowPic::IDD, pParent)
- {
- m_branchname = _T("");
- m_bRunning = false;
- m_bExit = FALSE;
- m_hThread = NULL;
- m_mode = 0;
- m_bdelall = 0;
- m_nDelCount = 0;
- m_hRefExitEvent = NULL;
- m_hThreadRef = NULL;
- m_bOriginalImg = FALSE;
- m_pUnKnown = NULL;
- //m_hEvent = NULL;
- }
- void ShowPic::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(ShowPic)
- DDX_Control(pDX, IDC_COMBO2, m_combobranch);
- DDX_Control(pDX, IDC_LIST1, m_List1);
- DDX_Control(pDX, IDC_COMBO1, m_combo1);
- DDX_CBString(pDX, IDC_COMBO2, m_branchname);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(ShowPic, CDialog)
- //{{AFX_MSG_MAP(ShowPic)
- ON_NOTIFY(NM_DBLCLK, IDC_LIST1, OnDblclkList1)
- //ON_WM_DESTROY()
- ON_BN_CLICKED(IDC_BUTdelall, OnBUTdelall)
- ON_BN_CLICKED(IDC_BUTdel, OnBUTdel)
- ON_BN_CLICKED(IDC_BUTupload, OnBUTupload)
- ON_BN_CLICKED(IDC_BUTselall, OnBUTselall)
- ON_CBN_SELCHANGE(IDC_COMBO2, OnSelchangeCombo2)
- ON_BN_CLICKED(IDC_BUTSetDesignNo, OnBUTSetDesignNo)
- ON_BN_CLICKED(IDC_BUTexport, OnBUTexport)
- ON_BN_CLICKED(IDC_BUT_RefreshPhotos, OnButRefreshPhotos)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // ShowPic message handlers
- BOOL ShowPic::OnInitDialog()
- {
- CDialog::OnInitDialog();
- m_id.MakeLower();
- // 1.移动到合适的位置;
- ::MoveWindow(m_hWnd, g_rc.left, g_rc.top, g_rc.Width(), g_rc.Height(), TRUE);
- // 2.获取窗口新的区域坐标值;
- CRect rcWnd;
- GetClientRect(rcWnd);
- // 3.自动处理控件大小与位置,共有9个控件;
- EnumChildWindows(m_hWnd, (WNDENUMPROC)EnumChildProc, 0);
- // 4.获取OK(关闭)按钮大小,并计算出放置控件的区域;
- CRect rcCtrl;
- GetDlgItem(IDOK)->GetWindowRect(rcCtrl);
- ScreenToClient(rcCtrl);
- // 5.计算出所有控件的显示区域;
- CRect rcAllCtrl;
- rcAllCtrl.top = rcCtrl.top;
- rcAllCtrl.bottom = rcCtrl.bottom;
- rcAllCtrl.left = rcWnd.left + 5;
- rcAllCtrl.right = rcWnd.right - 5;
- CRect *prcCtrl = SubgroubRectangle(rcAllCtrl, 5, 9);
- int hei = rcCtrl.Height();
- rcCtrl = rcWnd;
- rcCtrl.top = hei + 10;
- m_List1.MoveWindow(rcCtrl);
- int right = rcCtrl.right;
- // 关闭;
- GetDlgItem(IDOK)->GetWindowRect(rcCtrl);
- ScreenToClient(rcCtrl);
- int dtx = right - rcCtrl.right - 5;
- rcCtrl.top = 5;
- rcCtrl.bottom = rcCtrl.top + hei;
- rcCtrl.left += dtx;
- rcCtrl.right += dtx;
- GetDlgItem(IDOK)->MoveWindow(rcCtrl);
- //删除;
- GetDlgItem(IDC_BUTdel)->GetWindowRect(rcCtrl);
- ScreenToClient(rcCtrl);
- rcCtrl.top = 5;
- rcCtrl.bottom = rcCtrl.top + hei;
- rcCtrl.left += dtx;
- rcCtrl.right += dtx;
- GetDlgItem(IDC_BUTdel)->MoveWindow(rcCtrl);
- //全部删除;
- GetDlgItem(IDC_BUTdelall)->GetWindowRect(rcCtrl);
- ScreenToClient(rcCtrl);
- rcCtrl.top = 5;
- rcCtrl.bottom = rcCtrl.top + hei;
- rcCtrl.left += dtx;
- rcCtrl.right += dtx;
- GetDlgItem(IDC_BUTdelall)->MoveWindow(rcCtrl);
- CRect tmpRt(rcCtrl);
- GetDlgItem(IDC_BUTSetDesignNo)->GetWindowRect(rcCtrl);
- ScreenToClient(rcCtrl);
- rcCtrl.top = 5;
- rcCtrl.bottom = rcCtrl.top + hei;
- rcCtrl.left += dtx;
- rcCtrl.right += dtx;
- GetDlgItem(IDC_BUTSetDesignNo)->MoveWindow(rcCtrl);
- GetDlgItem(IDC_BUTexport)->GetWindowRect(rcCtrl);
- ScreenToClient(rcCtrl);
- rcCtrl.top = 5;
- rcCtrl.bottom = rcCtrl.top + hei;
- rcCtrl.left += dtx;
- rcCtrl.right += dtx;
- GetDlgItem(IDC_BUTexport)->MoveWindow(rcCtrl);
- //刷新按钮;
- CRect refeshRt(0, 0, 0, 0);
- GetDlgItem(IDC_BUT_RefreshPhotos)->GetWindowRect(refeshRt);
- //设计;
- if(m_mode == 5)
- tmpRt = rcCtrl;
- int nWide = refeshRt.right - refeshRt.left;
- tmpRt.left = tmpRt.left - nWide - 5;
- tmpRt.right = tmpRt.left + nWide;
- GetDlgItem(IDC_BUT_RefreshPhotos)->MoveWindow(tmpRt);
- //////////////////////////////////////////////////////////
- GetDlgItem(IDC_BUTupload)->GetWindowRect(rcCtrl);
- ScreenToClient(rcCtrl);
- rcCtrl.top = 5;
- rcCtrl.bottom = rcCtrl.top + hei;
- GetDlgItem(IDC_BUTupload)->MoveWindow(rcCtrl);
- GetDlgItem(IDC_BUTselall)->GetWindowRect(rcCtrl);
- ScreenToClient(rcCtrl);
- rcCtrl.top = 5;
- rcCtrl.bottom = rcCtrl.top + hei;
- GetDlgItem(IDC_BUTselall)->MoveWindow(rcCtrl);
- GetDlgItem(IDC_COMBO2)->GetWindowRect(rcCtrl);
- ScreenToClient(rcCtrl);
- rcCtrl.top = 5;
- rcCtrl.bottom = rcCtrl.top + hei + 300;
- GetDlgItem(IDC_COMBO2)->MoveWindow(rcCtrl);
- m_combobranch.ShowWindow(0);
- if (g_branchname == "")
- {
- GetDlgItem(IDC_BUTupload)->ShowWindow(0);
- GetDlgItem(IDC_BUTselall)->ShowWindow(0);
- }
- // else
- // GetDlgItem(IDC_BUTupload)->SetWindowText("上传至"+g_branchname);
- int i = 0;
- #ifdef ENTERPRISE_VERSION
- if (1)//g_branchname=="")
- {
- m_combobranch.ShowWindow(1);
- for ( i = 0; i < g_brancharray.GetSize() - 1; i++)
- {
- if (m_iparray.GetSize())
- {
- if (g_brancharray.ElementAt(i).ElementAt(2) == m_iparray.ElementAt(m_iparray.GetSize() - 1))continue;
- }
- m_combobranch.AddString(g_brancharray.ElementAt(i).ElementAt(0));
- m_iparray.Add(g_brancharray.ElementAt(i).ElementAt(2));
- }
- GetDlgItem(IDC_BUTupload)->ShowWindow(1);
- GetDlgItem(IDC_BUTselall)->ShowWindow(1);
- }
- #endif
- if (m_mode == 1 && IsHasRights2new(4) == 0)//拍照
- {
- GetDlgItem(IDC_BUTupload)->ShowWindow(0);
- GetDlgItem(IDC_BUTselall)->ShowWindow(0);
- }
- if (m_mode == 2 && IsHasRights2new(5) == 0)
- {
- GetDlgItem(IDC_BUTupload)->ShowWindow(0);
- GetDlgItem(IDC_BUTselall)->ShowWindow(0);
- }
- if (m_mode == 3 && IsHasRights2new(6) == 0)
- {
- GetDlgItem(IDC_BUTupload)->ShowWindow(0);
- GetDlgItem(IDC_BUTselall)->ShowWindow(0);
- }
- if (m_mode == 5 && IsHasRights2new(7) == 0)
- {
- GetDlgItem(IDC_BUTupload)->ShowWindow(0);
- GetDlgItem(IDC_BUTselall)->ShowWindow(0);
- }
- if (m_mode == 4)//礼服
- {
- GetDlgItem(IDC_BUTupload)->ShowWindow(0);
- GetDlgItem(IDC_BUTselall)->ShowWindow(0);
- }
- if (m_mode == 1)//拍照
- {
- GetDlgItem(IDC_BUTdelall)->EnableWindow(IsHasRights2new(34));
- GetDlgItem(IDC_BUTdel)->EnableWindow(IsHasRights2new(34));
- }
- else if (m_mode == 2)//初修
- {
- GetDlgItem(IDC_BUTdelall)->EnableWindow(IsHasRights2new(35));
- GetDlgItem(IDC_BUTdel)->EnableWindow(IsHasRights2new(35));
- }
- else if (m_mode == 3)//精修
- {
- GetDlgItem(IDC_BUTdelall)->EnableWindow(IsHasRights2new(36));
- GetDlgItem(IDC_BUTdel)->EnableWindow(IsHasRights2new(36));
- }
- else if (m_mode == 5)//设计
- {
- GetDlgItem(IDC_BUTdelall)->EnableWindow(IsHasRights2new(37));
- GetDlgItem(IDC_BUTdel)->EnableWindow(IsHasRights2new(37));
- GetDlgItem(IDC_BUTSetDesignNo)->EnableWindow(IsHasRights2new(7));
- GetDlgItem(IDC_BUTSetDesignNo)->ShowWindow(SW_SHOW);
- GetDlgItem(IDC_BUTexport)->EnableWindow(IsHasRights2new(12));
- GetDlgItem(IDC_BUTexport)->ShowWindow(SW_SHOW);
- }
- else if (m_mode == 4)//礼服
- {
- SetWindowText("礼服查看");
- GetDlgItem(IDC_BUTdelall)->EnableWindow(0);
- GetDlgItem(IDC_BUTdel)->EnableWindow(IsHasRights2new(43));
- m_combobranch.ShowWindow(1);
- g_sendhead.bsql = 0;
- g_sendhead.code[0] = 72;
- g_sendhead.tabcount = 1;
- g_pMainWnd->ProcessChatMessageRequest2(0);
- if (g_bSendOK == 0)
- {
- CDialog::OnCancel();
- return 0;
- }
- DataToArray(&m_List1array);
- CStringArray typearray;
- for ( i = 0; i < m_List1array.GetSize(); i++)
- {
- if (-1 == FindArray(&typearray, m_List1array.ElementAt(i).ElementAt(0)))
- typearray.Add(m_List1array.ElementAt(i).ElementAt(0));
- }
- m_combobranch.AddString("全部");
- for (i = 0; i < typearray.GetSize(); i++)
- {
- m_combobranch.AddString(typearray.ElementAt(i));
- }
- m_combobranch.SetCurSel(0);
- }
- //加载相片和文件夹icon;
- LoadImageFromRes(&m_pUnKnown, MAKEINTRESOURCE(PNG_UNKNOWN), _T("PNG"));
- if( m_pUnKnown == NULL )
- {
- MessageBox(_T("加载图标失败"));
- return FALSE;
- }
- m_ImageListThumb.Create(THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT, ILC_COLOR24, 0, 1);
- m_List1.SetImageList(&m_ImageListThumb, LVSIL_NORMAL);
- LoadPhotos();
- return TRUE; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
- }
- /************************************************************************/
- /* 函数:[6/1/2016 IT];
- /* 描述:;
- /* 参数:;
- /* [IN] :;
- /* [OUT] :;
- /* [IN/OUT] :;
- /* 返回:void;
- /* 注意:;
- /* 示例:;
- /*
- /* 修改:;
- /* 日期:;
- /* 内容:;
- /************************************************************************/
- CRect* ShowPic::SubgroubRectangle(IN CRect rc, IN const INT& nDivWidth, IN const INT &nDivisions)
- {
- if ( rc.IsRectEmpty() )
- return NULL;
- CRect *pRect = new CRect[nDivisions];
- INT nRealWidth = rc.Width() - nDivWidth*(nDivisions-1);
- INT nSumWidth = 0;
- for ( int i = 0; i < nDivisions; i++ )
- {
- pRect[i].top = rc.top;
- pRect[i].bottom = rc.bottom;
- pRect[i].left = nSumWidth;
- pRect[i].right = pRect[i].left + nRealWidth;
- nSumWidth += nRealWidth + nDivWidth;
- }
- return pRect;
- }
- /************************************************************************/
- /* 函数:AddListItemName[6/1/2016 IT];
- /* 描述:添加项名称到ListCtrl列表中;
- /* 参数:;
- /* [IN] pThis:;
- /* [IN] pListCtrl:;
- /* [IN] AryItemName:;
- /* 返回:void;
- /* 注意:;
- /* 示例:;
- /*
- /* 修改:;
- /* 日期:;
- /* 内容:;
- /************************************************************************/
- BOOL ShowPic::AddListItemName(IN ShowPic* pThis, IN CListCtrl* pListCtrl, IN IN CStringArray& AryItemName)
- {
- if ( pListCtrl == NULL || AryItemName.GetSize() == 0 )
- return FALSE;
- // 1.清除pListCtrl项;
- pListCtrl->DeleteAllItems();
- pListCtrl->Invalidate();
- // 2.逐个名字项添加;
- INT nPos = -1;
- // 插入名字时,不进行重绘,减少消耗;
- pListCtrl->SetRedraw(FALSE);
- for ( int i = 0; !pThis->m_bExit && i < AryItemName.GetSize(); i++ )
- {
- CString strImg = AryItemName.ElementAt(i);
- // 查找订单号;
- nPos = strImg.Find(pThis->m_id);
- if ( nPos != -1 )
- {
- // 留下订单号后面的内容(景点名);
- strImg = strImg.Mid(nPos + pThis->m_id.GetLength() + 1);
- nPos = strImg.ReverseFind(_T('.'));
- if ( nPos != -1 )
- strImg = strImg.Left(nPos);
- if ( !pThis->m_bOriginalImg )
- pListCtrl->InsertItem(i, strImg, i);
- else
- pListCtrl->InsertItem(i, strImg, 0);
- }
- }
- // 添加完成后,重绘列表;
- pListCtrl->SetRedraw(TRUE);
- return TRUE;
- }
- /************************************************************************/
- /* 函数:[6/1/2016 IT];
- /* 描述:;
- /* 参数:;
- /* [IN] :;
- /* [OUT] :;
- /* [IN/OUT] :;
- /* 返回:void;
- /* 注意:;
- /* 示例:;
- /*
- /* 修改:;
- /* 日期:;
- /* 内容:;
- /************************************************************************/
- void ShowPic::ZoomImage(Image* pImage, Rect& desRt)
- {
- int XDest(0), YDest(0), nDestWidth(0), nDestHeight(0);
- const float fRatio = (float)THUMBNAIL_HEIGHT / THUMBNAIL_WIDTH;
- const float fImgRatio = (float)pImage->GetHeight() / pImage->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;
- }
- desRt.X = XDest;
- desRt.Y = YDest;
- desRt.Width = nDestWidth;
- desRt.Height = nDestHeight;
- }
- /************************************************************************/
- /* 函数:DrawListItemImg[6/1/2016 IT];
- /* 描述:;
- /* 参数:;
- /* [IN] :;
- /* [OUT] :;
- /* [IN/OUT] :;
- /* 返回:void;
- /* 注意:如果没有生成小图,加载大图时,会造成函数用时超长,从而导致线程结束不及时,List也可能被释放;
- /* 示例:;
- /*
- /* 修改:;
- /* 日期:;
- /* 内容:;
- /************************************************************************/
- void ShowPic::DrawListItemImg(IN ShowPic* pThis, IN CListCtrl* pListCtrl, IN CImageList* pImgList, IN CStringArray& AryItemName)
- {
- if ( pListCtrl == NULL || pImgList == NULL || AryItemName.GetSize() == 0)
- return;
- Bitmap *pBitmap = NULL;
- // 1.是否是原始格式的相片;
- if ( pThis->m_bOriginalImg )
- {
- // 创建bitmap使用白颜色填充区域;
- SolidBrush whitebrush(Color(255, 255, 255, 255));
- pBitmap = new Bitmap(THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT, PixelFormat24bppRGB);
- Graphics graph(pBitmap);
- graph.Clear(Color(255, 192, 192, 192));
- graph.FillRectangle(&whitebrush, 1, 1, THUMBNAIL_WIDTH -2 , THUMBNAIL_HEIGHT -2);
- graph.Save();
- // 缩放图片以符合画布大小;
- if ( pThis->m_pUnKnown == NULL )
- LoadImageFromRes(&pThis->m_pUnKnown, MAKEINTRESOURCE(PNG_UNKNOWN), _T("PNG"));
- Rect desrc(0,0,0,0);
- ZoomImage(pThis->m_pUnKnown, desrc);
- // 绘制图标res\unknown.png;
- Graphics graph2(pBitmap);
- graph2.DrawImage(pThis->m_pUnKnown, desrc, 0, 0, pThis->m_pUnKnown->GetWidth(), pThis->m_pUnKnown->GetHeight(), UnitPixel);
- // 将图片替换bitmap添加到图标列表;
- CBitmap bitmap;
- HBITMAP hbmp;
- pBitmap->GetHBITMAP(Color(255, 255, 255, 255), &hbmp);
- bitmap.Attach(hbmp);
- for ( int i = 0; !pThis->m_bExit && i < AryItemName.GetSize(); i++ )
- {
- AutoThreadSection aSection(&m_ThreadSection);
- if (!pThis->m_bExit /*&& ::IsWindow(pListCtrl->m_hWnd)*/)
- {
- pImgList->Replace(i, &bitmap, NULL);
- pListCtrl->RedrawItems(i, i);
- }
- }
- if ( pBitmap )
- delete pBitmap;
- pBitmap = NULL;
- }
- else
- {
- INT nPos = -1;
- Image* pImage = NULL;
- for ( int i = 0; !pThis->m_bExit && i < AryItemName.GetSize(); i++ )
- {
- pImage = NULL;
- pBitmap = NULL;
- CString strImg = AryItemName.ElementAt(i);
- nPos = strImg.ReverseFind(_T('\\'));
- if ( nPos != -1 )
- {
- CString strSmallImg = strImg.Left( nPos + 1);
- strSmallImg += _T("s");
- strSmallImg += strImg.Mid(nPos+1);
- // 小图存在时;
- if ( PathFileExists(strSmallImg) )
- {
- LoadImageFromBuf(&pImage, strSmallImg);
- }
- else
- {// 无小图,加载大图;
- strImg.MakeLower();
- if (strImg.Right(3) != _T("jpg") && strImg.Right(4) != _T("jpeg"))
- continue;
- LoadImageFromBuf(&pImage, strImg);
- }
- if ( pImage == NULL )
- continue;
- // 旋转侧拍的相片;
- int nOrientation = GetOrientation(pImage);
- if (nOrientation == 8)
- pImage->RotateFlip(Rotate270FlipNone);
- else if (nOrientation == 6)
- pImage->RotateFlip(Rotate90FlipNone);
- if (pImage->GetWidth() == 0)
- {
- delete pImage;
- continue;
- }
- // 创建bitmap使用白颜色填充区域;
- SolidBrush whitebrush(Color(255, 255, 255, 255));
- pBitmap = new Bitmap(THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT, PixelFormat24bppRGB);
- Graphics graph(pBitmap);
- graph.Clear(Color(255, 192, 192, 192));
- graph.FillRectangle(&whitebrush, 1, 1, THUMBNAIL_WIDTH -2 , THUMBNAIL_HEIGHT -2);
- graph.Save();
- // 缩放图片以符合画布大小;
- Rect desrc(0,0,0,0);
- ZoomImage(pImage, desrc);
- // 绘制图标;
- Graphics graph2(pBitmap);
- graph2.DrawImage(pImage, desrc, 0, 0, pImage->GetWidth(), pImage->GetHeight(), UnitPixel);
- if ( pImage )
- delete pImage;
- pImage = NULL;
- // 将图片替换bitmap添加到图标列表;
- CBitmap bitmap;
- HBITMAP hbmp;
- pBitmap->GetHBITMAP(Color(255, 255, 255, 255), &hbmp);
- bitmap.Attach(hbmp);
- if ( pBitmap )
- delete pBitmap;
- pBitmap = NULL;
- AutoThreadSection aSection(&m_ThreadSection);
- if (!pThis->m_bExit /*&& ::IsWindow(pListCtrl->m_hWnd)*/)
- {
- pImgList->Replace(i, &bitmap, NULL);
- pListCtrl->RedrawItems(i, i);
- }
- }
- }
- }
- #ifdef _DEBUG
- TRACE("退出DrawListItemImg\n");
- #endif
- }
- DWORD ShowPic::LoadThumbNail(LPVOID lpParam)
- {
- try
- {
- ShowPic *pDlg = (ShowPic*)lpParam;
- CListCtrl *ListCtrl = &pDlg->m_List1;
- CImageList* pImgList = &pDlg->m_ImageListThumb;
- for (int i = 0; !pDlg->m_bExit && i < pImgList->GetImageCount(); i++)
- pImgList->Remove(i);
- ListCtrl->DeleteAllItems();
- pImgList->SetImageCount(pDlg->m_vFileName.GetSize());
- if ( pDlg->m_bExit )
- {
- pDlg->m_bRunning = false;
- pDlg->m_bExit = false;
- return 0;
- }
- ListCtrl->Invalidate();
- AddListItemName(pDlg, ListCtrl, pDlg->m_vFileName);
- DrawListItemImg(pDlg, ListCtrl, pImgList, pDlg->m_vFileName);
- if (!pDlg->m_bExit)
- ListCtrl->Invalidate();
- pDlg->m_bRunning = false;
- pDlg->m_bExit = false;
- return 0;
- }
- catch (...)
- {
- }
- return 0;
- }
- /************************************************************************/
- /*
- 函数:TerminateRefreshTh
- 描述:结束刷新图片线程
- 参数:
- 返回:
- */
- /************************************************************************/
- BOOL ShowPic::TerminateRefreshTh()
- {
- //设为有信号
- if(m_hRefExitEvent)
- SetEvent(m_hRefExitEvent);
- //等待线程结束
- if(m_hThreadRef)
- WaitForSingleObject(m_hThreadRef, INFINITE);
- if(m_hRefExitEvent)
- {
- ::CloseHandle(m_hRefExitEvent);
- m_hRefExitEvent = NULL;
- }
- if(m_hThreadRef)
- {
- ::CloseHandle(m_hThreadRef);
- m_hThreadRef = NULL;
- }
- return TRUE;
- }
- /************************************************************************/
- /*
- 函数:RefreshThFun
- 描述:刷新
- 参数:
- 返回:
- */
- /************************************************************************/
- void ShowPic::RefreshWork()
- {
- BOOL bFinish = TRUE;
- for(int i=0; i<m_patharray1.GetSize(); i++)
- {
- // 等待退出信号;
- if(m_hRefExitEvent && WaitForSingleObject(m_hRefExitEvent, 0) == WAIT_OBJECT_0)
- {
- bFinish = FALSE;
- break;
- }
- CString str = m_patharray1.ElementAt(i);
- CString spath = str.Left(str.ReverseFind('\\') + 1);
- spath += "s";
- spath += str.Right(str.GetLength() - str.ReverseFind('\\') - 1);
- if(!::PathFileExists(spath))
- ImgThumbnail(m_patharray1.ElementAt(i), SET_PIX(100, 76), spath, 100);
- spath = str.Left(str.ReverseFind('\\') + 1);
- spath += "m";
- spath += str.Right(str.GetLength() - str.ReverseFind('\\') - 1);
- if(!::PathFileExists(spath))
- ImgThumbnail(m_patharray1.ElementAt(i), SET_PIX(2000, 1500), spath, 100);
- }
- if(bFinish)
- {
- MessageBox(_T("刷新完成"));
- LoadThumbImages();
- }
- }
- /************************************************************************/
- /*
- 函数:RefreshThFun
- 描述:线程函数
- 参数:
- 返回:
- */
- /************************************************************************/
- unsigned __stdcall RefreshThFun(LPVOID lpParam)
- {
- ShowPic* p = (ShowPic*)lpParam;
- try
- {
- p->RefreshWork();
- return 0;
- }
- catch (CException* e)
- {
- return 0;
- }
- }
- void ShowPic::LoadThumbImages()
- {
- ExitLoadThread();
- m_hThread = CreateThread(NULL, 0, LoadThumbNail, this, 0, NULL);
- if( m_hThread )
- {
- m_bRunning = true;
- }
- }
- BOOL ShowPic::ExitLoadThread()
- {
- if ( m_bRunning ) m_bExit = true;
- if ( m_hThread )
- {
- while( WaitForSingleObject(m_hThread,0) == WAIT_OBJECT_0 )
- //while(GetExitCodeThread(m_hThread, 0))
- {
- Sleep(100); // 由于该线程内容调用到各种主线程的窗口事件,所以不能死等,必须Sleep以保持主窗口线程鲜活;
- break;
- #ifdef _DEBUG
- TRACE("线程已完成\n");
- #endif
- }
- CloseHandle(m_hThread);
- m_hThread = NULL;
- }
- #ifdef _DEBUG
- TRACE("\n退出显示线程\n");
- #endif
- return TRUE;
- }
- void ShowPic::OnDblclkList1(NMHDR* pNMHDR, LRESULT* pResult)
- {
- if ( m_bOriginalImg )
- {
- MessageBox(_T("不支持查看原始格式相片!"), _T("温馨提示!"), MB_OK|MB_ICONHAND);
- return;
- }
- POSITION pos;
- pos = m_List1.GetFirstSelectedItemPosition();
- if (pos == NULL)
- {
- return;
- }
- int iItem = m_List1.GetNextSelectedItem(pos);
- ShowPic22 dlg;
- dlg.m_nCurImgPos = iItem;
- dlg.m_pAryImgPath = &m_patharray1;
- dlg.DoModal();
- *pResult = 0;
- }
- /*
- 事件执行顺序:WM_CLOSE ->WM_SYSCOMMAND ->WM_COMMAND(IDCANCEL)->WS_DESTROY->WM_NCDESTROY
- 所以,不在能DESTROY里退出,因为List已经被释放了;
- void ShowPic::OnDestroy()
- {
- m_bExit = true;
- #ifdef _DEBUG
- TRACE("退出窗口\n");
- #endif
- ExitLoadThread();
- TerminateRefreshTh();
- CDialog::OnDestroy();
- }
- */
- void ShowPic::LoadPhotos() // 从订单目录中加载相片;
- {
- #ifdef USE_KERNEL_DLL
- if ( m_mode == 4 )
- {// 礼服;
- CString str = _T("");
- CString savepath = g_path5 + _T("\\");
- int i = 0;
- for ( i = 0; i < m_List1array.GetSize(); i++)
- {
- if (m_type != _T("") && m_type != _T("全部") && m_type != m_List1array.ElementAt(i).ElementAt(0))
- continue;
- OutputDebugString(m_List1array.ElementAt(i).ElementAt(1) + _T("\n"));
- CString str = savepath + m_List1array.ElementAt(i).ElementAt(1) + _T(".jpg");
- if ( PathFileExists(str) )
- m_patharray1.Add(str);
- }
- if (m_bRunning)return;
- CStringArray *pArray = &m_patharray1;
- m_vFileName.RemoveAll();
- for ( i = 0; i < pArray->GetSize(); i++)
- {
- CString filePath = pArray->ElementAt(i);
- filePath.MakeLower();
- m_vFileName.Add(filePath);
- }
- LoadThumbImages();
- return;
- }
- // 非礼服,原片、初修片、精修片、设计片;
- INT nImgType = m_mode;
- if ( m_mode == 5)
- nImgType--;
- CStringArray AryLoadExtImgpath;
- CStringArray AryWithExtImgpath;
- CString strBranchId = g_branchname.IsEmpty() ? g_domain : GetDomainFromBranch(g_branchname);
- if ( GetOrderImgpathEx(nImgType, strBranchId, m_id, TRUE, _T("*.jpg|*.jpeg"), _T("*.cr2|*.raw|*.nef|*.ra2"), AryLoadExtImgpath, AryWithExtImgpath, m_aryOfShareDirectory))
- {
- INT i = 0;
- CString str;
- m_patharray1.RemoveAll();
- CString strfilename;
- INT nSize = AryLoadExtImgpath.GetSize();
- if ( nSize == 0 && AryWithExtImgpath.GetSize() )
- { // 没有jpg可显示的相片,但有原始格式的相片;
- m_bOriginalImg = TRUE;
- nSize = AryWithExtImgpath.GetSize();
- for (i = 0; i < nSize; i++ )
- {
- str = AryWithExtImgpath.ElementAt(i);
- if (str.GetAt(str.ReverseFind('\\') + 1) == 's')continue;
- if (str.GetAt(str.ReverseFind('\\') + 1) == 'm')continue;
- str.MakeLower();
- if (!g_bOriginal && m_mode == 1) // 拍照;
- {
- strfilename = str.Right(str.GetLength() - str.ReverseFind('\\') - 1);
- if (strfilename.ReverseFind(_T('.')) != -1)
- strfilename = strfilename.Left(strfilename.ReverseFind(_T('.')));
- // 若只是用于系统数字编号的,可以使用Isdigit来判断相片编号是否为数字编号;
- if ( !myisdigit(strfilename) )
- continue;
- }
- m_patharray1.Add(str);
- }
- }
- else
- {
- m_bOriginalImg = FALSE;
- for (i = 0; i < nSize; i++ )
- {
- str = AryLoadExtImgpath.ElementAt(i);
- if (str.GetAt(str.ReverseFind('\\') + 1) == 's')continue;
- if (str.GetAt(str.ReverseFind('\\') + 1) == 'm')continue;
- str.MakeLower();
- if (!g_bOriginal && m_mode == 1) // 拍照;
- {
- strfilename = str.Right(str.GetLength() - str.ReverseFind('\\') - 1);
- if (strfilename.ReverseFind(_T('.')) != -1)
- strfilename = strfilename.Left(strfilename.ReverseFind(_T('.')));
- // 若只是用于系统数字编号的,可以使用Isdigit来判断相片编号是否为数字编号;
- if ( !myisdigit(strfilename) )
- continue;
- }
- m_patharray1.Add(str);
- }
- }
- if (m_bRunning)return;
- CStringArray *pArray = &m_patharray1;
- m_vFileName.RemoveAll();
- for ( i = 0; i < pArray->GetSize(); i++)
- {
- CString filePath = pArray->ElementAt(i);
- filePath.MakeLower();
- m_vFileName.Add(filePath);
- }
- LoadThumbImages();
- }
- else
- {
- // 如果没有找到目录,则清空所有list项目;
- for (int i = 0; i < m_ImageListThumb.GetImageCount(); i++)
- m_ImageListThumb.Remove(i);
- m_List1.DeleteAllItems();
- }
- if ( m_mode == 1)
- {
- CString strText ;
- strText.Format(_T("客户照片查看,当前张数:%ld"), m_vFileName.GetSize());
- SetWindowText(strText);
- }
- #else
- m_patharray1.RemoveAll();
- m_path.MakeLower();
- CStringArray dirarray;
- CString str;
- if (m_mode == 4)//礼服
- {
- CString savepath = g_path5 + "\\";
- for (int i = 0; i < m_List1array.GetSize(); i++)
- {
- if (m_type != "" && m_type != "全部" && m_type != m_List1array.ElementAt(i).ElementAt(0))
- continue;
- // str=savepath+"s"+m_List1array.ElementAt (i).ElementAt (1)+".jpg";
- str = savepath + m_List1array.ElementAt(i).ElementAt(1) + ".jpg";
- if (::PathFileExists(str))
- m_patharray1.Add(str);
- }
- }
- else
- {
- #if USE_SHARE_FLORD // 多级共享目录查看相片;
- int nPhotoType = m_mode;
- if ( m_mode == 5)
- nPhotoType--;
- // 根据域名,相片类型,订单号查找相片;
- //LoadPhotos(nPhotoType, m_id, m_branch);
- m_aryOfShareDirectory.RemoveAll();
- CNetShareInfo::GetInstance()->LoadOrderImages(nPhotoType, m_id, m_branch, m_patharray1, &m_aryOfShareDirectory);
- #else
- if (1)
- {
- using namespace helper_coffs;
- ffsco o;
- o.dirs(1);
- o.find(LPCSTR(m_path), LPCSTR("*.*"));
- ffsco::typeT coo;
- ffsco::typeT::iterator it;
- // 1.获得所有子文件夹;
- coo = o.co_dir();
- for (it = coo.begin();coo.end() != it;it++)
- {
- str = (*it).c_str();
- if (FindArray(&dirarray, str) == -1)
- {
- dirarray.Add(str);
- }
- }
- }
- if (1)
- {
- CString filename;
- for (int i = 0; i < dirarray.GetSize(); i++)
- {
- using namespace helper_coffs;
- ffsco o;
- o.dirs(0);
- if (m_mode == 1)//拍照
- o.find(LPCSTR(dirarray.ElementAt(i)), LPCSTR("*.*"));
- else
- o.find(LPCSTR(dirarray.ElementAt(i)), LPCSTR("*.jpg"));
- ffsco::typeT coo;
- ffsco::typeT::iterator it;
- // 2.获得所有子文件夹下的文件;
- 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();
- if (m_mode == 1)//拍照
- {
- filename = str.Right(str.GetLength() - str.ReverseFind('\\') - 1);
- if (filename.Find(".") != -1)
- filename = filename.Left(filename.Find("."));
- if (!myisdigit(filename))continue;
- }
- m_patharray1.Add(str);
- }
- }
- }
- #endif
- }
- 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();
- #endif
- }
- void ShowPic::OnBUTdelall() // 全部删除按钮;
- {
- // TODO: Add your control notification handler code here
- if (AfxMessageBox("删除后将无法恢复, 确认删除吗?", MB_YESNO | MB_ICONSTOP) != IDYES)return;
- #if USE_SHARE_FLORD // 2015.04.13
- // 删除多级共享目录下的全部订单相片;
- int nSize = m_aryOfShareDirectory.GetSize();
- for ( int i = 0; i < nSize; i++)
- {
- DeleteDirectory(m_aryOfShareDirectory.ElementAt(i));
- }
- LoadPhotos();
- #else
- CString path = m_path;
- path.TrimRight('\\');
- DeleteDirectory(path); // 递归删除全部查看的jpg:
- LoadPhotos();
- #endif
- if (m_mode == 1)
- {
- CString sql;
- sql = "update dindan set [curno]='1' where [id]='" + m_id + "'";
- g_sendhead.bsql = 1;
- g_pMainWnd->ProcessChatMessageRequest2(sql);
- m_bdelall = 1;
- }
- #if 1
- CString str;
- str = "清除";
- str += m_name;
- str += m_id;
- str += "全部";//Jeff.add;
- if (m_mode == 1)
- str += "原片";
- else if (m_mode == 2)
- str += "初修片";
- else if (m_mode == 3)
- str += "精修片";
- else if (m_mode == 5)
- str += "设计片";
- WriteLog("清除订单相片", str);
- #endif
- if (g_branchname != "")
- {
- str.Format("是否同步删除分店 %s 的照片?", g_branchname);
- if (AfxMessageBox(str, MB_YESNO | MB_ICONSTOP) != IDYES)return;
- CString sql = "deletephotos";
- if (m_mode == 1)//拍照
- sql += "0";
- else if (m_mode == 2)//初修
- sql += "1";
- else if (m_mode == 3)//精修
- sql += "2";
- else if (m_mode == 5)//设计
- sql += "3";
- sql += m_id;
- sql += ";";
- CString jd;
- if (m_mode == 1)
- { //拍照,加景点
- CString file2 = m_path;
- int pos = file2.Find(m_id);
- pos += m_id.GetLength();
- int pos2 = file2.ReverseFind('\\');
- if (pos2 > pos)
- {
- jd = file2.Mid(pos + 1, pos2 - pos - 1);
- }
- }
- sql += "all";
- sql += jd;
- g_sendhead.bsql = 1;
- g_pMainWnd->ProcessChatMessageRequest2(sql); if (g_bSendOK == 0)return;
- AfxMessageBox("远程删片成功!", MB_ICONINFORMATION);
- #if 1//Jeff add;
- CString strDelContent;
- if (m_mode == 1)
- str += "原片";
- else if (m_mode == 2)
- str += "初修片";
- else if (m_mode == 3)
- str += "精修片";
- else if (m_mode == 5)
- str += "设计片";
- strDelContent.Format("客人%s,订单号%s的分店%s的全部%s被同步删除", m_name, m_id, g_branchname, str);
- WriteLog("删除分店照片", strDelContent);
- #endif
- }
- else if (m_branch != "")
- {
- if (GetBranchPhotoPath(m_branch) == "")return;
- str.Format("是否同步删除分店 %s 的照片?", m_branch);
- if (AfxMessageBox(str, MB_YESNO | MB_ICONSTOP) != IDYES)return;
- CString sql = "deletephotos";
- if (m_mode == 1)//拍照
- sql += "0";
- else if (m_mode == 2)//初修
- sql += "1";
- else if (m_mode == 3)//精修
- sql += "2";
- else if (m_mode == 5)//设计
- sql += "3";
- sql += m_id;
- sql += ";";
- CString jd;
- if (m_mode == 1)
- { //拍照,加景点
- CString file2 = m_path;
- int pos = file2.Find(m_id);
- pos += m_id.GetLength();
- int pos2 = file2.ReverseFind('\\');
- if (pos2 > pos)
- {
- jd = file2.Mid(pos + 1, pos2 - pos - 1);
- }
- }
- sql += "all";
- sql += jd;
- g_sendhead.bsql = 1;
- g_branchip = GetIP(m_branch);
- g_pMainWnd->OnDisconnect();
- g_branchname = m_branch;
- g_bBranchModify = 1;
- g_pMainWnd->ProcessChatMessageRequest2(sql);
- g_pMainWnd->OnDisconnect(); g_bBranchModify = 0; g_branchip = g_branchname = "";
- if (g_bSendOK == 0)return;
- AfxMessageBox("远程删片成功!", MB_ICONINFORMATION);
- #if 1//Jeff add;
- CString strDelContent;
- if (m_mode == 1)
- str += "原片";
- else if (m_mode == 2)
- str += "初修片";
- else if (m_mode == 3)
- str += "精修片";
- else if (m_mode == 5)
- str += "设计片";
- strDelContent.Format("客人%s,订单号%s的分店%s的全部%s被同步删除", m_name, m_id, g_branchname, str);
- WriteLog("删除分店照片", strDelContent);
- #endif
- }
- }
- void ShowPic::OnBUTdel() // 删除按钮;
- {
- #if USE_SHARE_FLORD
- // 获取list列表中选中的相片集合;
- CStringArray delarray;
- GetAllSelectImage(delarray);
- int nPhotoType = m_mode;
- if ( m_mode == 5)
- {
- nPhotoType--;
- }
- CString strDomain;
- CStringArray strAryOfDeleted;
- if ( !m_branch.IsEmpty() )
- {
- strDomain = GetDomainFromBranch(m_branch);
- }
- else
- {
- strDomain = g_branchname;
- }
- int i = 0;
- for(i = 0; i<delarray.GetSize(); i++)
- {
- for ( int nIndex = 0; nIndex < m_vFileName.GetSize(); nIndex++)
- {
- CString str = m_vFileName.ElementAt(nIndex);
- if(str != _T(""))
- {
- CString strdel = delarray.ElementAt(i);
- // 如果是精修片目录里,会有多个子文件夹,而且每个子文件夹都可能会有相同名称的相片;
- if ( strdel.Find(_T("\\")) != -1)
- {// 子文件夹;
- if ( str.Find(strdel) != -1 )
- {
- strAryOfDeleted.Add(m_vFileName.ElementAt(nIndex));
- }
- }
- else
- {// 根目录,从订单号截断;
- if ( str.Find(m_id) != -1 )
- {
- str = str.Mid(str.Find(m_id) + m_id.GetLength() + 1);
- if ( str.Find(_T("\\")) == -1 )
- {// 排除掉子目录;
- str = str.Right(str.GetLength() - str.ReverseFind('\\') - 1);
- str = str.Left(str.Find(_T(".")));
- if(str.CompareNoCase(strdel) == 0)
- strAryOfDeleted.Add(m_vFileName.ElementAt(nIndex));
- }
- }
- }
- }
- }
- }
- int nDelCount = strAryOfDeleted.GetSize();
- //////////////////////////////////////////////////////////////////////////
- // 删除已找到的相片文件;
- CString strTemp;
- for ( int n = 0; n < nDelCount; n++)
- {
- // 删除原相片;
- strTemp = strAryOfDeleted.ElementAt(n);
- DeleteFile(strTemp);
- strTemp.MakeLower();
- strTemp.Replace(_T(".jpg"),_T(".nef"));
- DeleteFile(strTemp);
- strTemp.Replace(_T(".nef"),_T(".cr2"));
- DeleteFile(strTemp);
- strTemp.Replace(_T(".cr2"),_T(".raw"));
- DeleteFile(strTemp);
- strTemp.Replace(_T(".raw"),_T(".jpg"));
- // 再删除s+m缩略图;
- CString strAblum;
- CString strLeft, strRight;
- int nIndex = strTemp.ReverseFind('\\');
- strLeft = strTemp.Left( nIndex + 1 );
- strRight = strTemp.Mid( nIndex + 1);
- strAblum.Format("%ss%s",strLeft,strRight);
- DeleteFile(strAblum);
- strAblum.Format("%sm%s",strLeft,strRight);
- DeleteFile(strAblum);
- // 若是原片,则要删除原片目录下的上传任务;
- if ( m_mode == 1 && !g_branchname.IsEmpty() )
- {
- // 暂时空处理,此处逻辑未明确;
- }
- }
- // 重新加载相片;
- LoadPhotos();
- // 写删除日志;
- switch( m_mode )
- {
- case 1:
- strTemp.Format("删除<%s>订单<%s>的原片%d张",m_name,m_id,nDelCount);
- break;
- case 2:
- strTemp.Format("删除<%s>订单<%s>的初修片%d张",m_name,m_id,nDelCount);
- break;
- case 3:
- strTemp.Format("删除<%s>订单<%s>的精修片%d张",m_name,m_id,nDelCount);
- break;
- case 5:
- strTemp.Format("删除<%s>订单<%s>的设计片%d张",m_name,m_id,nDelCount);
- break;
- default:
- break;
- }
- WriteLog("删除订单相片", strTemp);
- // 当连接分店时,除了删除本店的相片外,还要删除外网分店的相片;
- if ( !g_branchname.IsEmpty() && strAryOfDeleted.GetSize() )
- {
- strTemp.Format("是否同步删除分店 %s 的照片?", g_branchname);
- if( AfxMessageBox(strTemp, MB_YESNO|MB_ICONSTOP) != IDYES )
- return;
- strTemp = "deletephotos";
- if( m_mode == 1 )
- strTemp += "0";
- else if( m_mode == 2 )
- strTemp += "1";
- else if( m_mode == 3 )
- strTemp += "2";
- else if( m_mode == 5 )
- strTemp += "3";
- strTemp += m_id;
- strTemp += ":";
- for(int i = 0; i < delarray.GetSize(); i++)
- {
- strTemp += delarray.ElementAt(i);
- strTemp += ",";
- }
- g_sendhead.bsql = 1;
- g_pMainWnd->ProcessChatMessageRequest2(strTemp);
- if( g_bSendOK == 0 )
- return;
- AfxMessageBox("远程删片成功!", MB_ICONINFORMATION);
- // 日志记录;
- if(m_mode==1)
- strTemp.Format("<%s>订单<%s>分店<%s>的原片被同步删除",m_name, m_id, g_branchname);
- else if(m_mode==2)
- strTemp.Format("<%s>订单<%s>分店<%s>的初修片被同步删除",m_name, m_id, g_branchname);
- else if(m_mode==3)
- strTemp.Format("<%s>订单<%s>分店<%s>的精修片被同步删除",m_name, m_id, g_branchname);
- else if(m_mode==5)
- strTemp.Format("<%s>订单<%s>分店<%s>的设计片被同步删除",m_name, m_id, g_branchname);
- WriteLog("分店相片同步删除", strTemp);
- }
- // 当多店汇总时,通过分店名得到分店域名,再删除分店的相片;
- if ( !m_branch.IsEmpty() && strAryOfDeleted.GetSize() )
- {
- if ( strDomain.IsEmpty() )
- return;
- strTemp.Format( "是否同步删除分店 %s 的照片?", m_branch );
- if( AfxMessageBox(strTemp, MB_YESNO|MB_ICONSTOP) != IDYES )
- return;
- strTemp = "deletephotos";
- if( m_mode == 1 )
- strTemp += "0";
- else if( m_mode == 2 )
- strTemp += "1";
- else if( m_mode == 3 )
- strTemp += "2";
- else if( m_mode == 5 )
- strTemp += "3";
- strTemp += m_id;
- strTemp += ":";
- for(int i = 0; i < delarray.GetSize(); i++)
- {
- strTemp += delarray.ElementAt(i);
- strTemp += ",";
- }
- g_sendhead.bsql = 1;
- g_pMainWnd->ProcessChatMessageRequest2(strTemp);
- if( g_bSendOK == 0 )
- return;
- AfxMessageBox("远程删片成功!", MB_ICONINFORMATION);
- // 日志记录;
- if(m_mode==1)
- strTemp.Format("<%s>订单<%s>分店<%s>的原片被同步删除",m_name, m_id, g_branchname);
- else if(m_mode==2)
- strTemp.Format("<%s>订单<%s>分店<%s>的初修片被同步删除",m_name, m_id, g_branchname);
- else if(m_mode==3)
- strTemp.Format("<%s>订单<%s>分店<%s>的精修片被同步删除",m_name, m_id, g_branchname);
- else if(m_mode==5)
- strTemp.Format("<%s>订单<%s>分店<%s>的设计片被同步删除",m_name, m_id, g_branchname);
- WriteLog("分店相片同步删除", strTemp);
- }
- // 直接返回,不执行旧过程;
- return ;
- #else
- // TODO: Add your control notification handler code here
- POSITION pos;
- pos = m_List1.GetFirstSelectedItemPosition();
- if (pos == NULL)
- {
- AfxMessageBox("请先选中您要删除的照片!", MB_ICONINFORMATION);
- return;
- }
- if (AfxMessageBox("删除后将无法恢复, 确认删除吗?", MB_YESNO | MB_ICONSTOP) != IDYES)return;
- CStringArray delarray;
- //int nDelCount = 0; // Jeff add:被删除的相片数量;// 使用m_nDelCount成员变量;
- CString strDelContent; // Jeff add:删除操作的日志内容;
- //CStringArray strDelArray; // Jeff add:被删除的相片名称;
- while (pos)
- {
- int iItem = m_List1.GetNextSelectedItem(pos);
- CString title = m_List1.GetItemText(iItem, 0);
- // log的内容字段长度有限,写不下这么多文字;
- // 被删除的文件名不记录,只记录删除的张数;
- ::DeleteFile(m_path + title + ".jpg"); // 删除jpg;
- ::DeleteFile(m_path + title + ".NEF"); // 删除NEF;
- ::DeleteFile(m_path + title + ".CR2"); // 删除CR2;
- ::DeleteFile(m_path + title + ".raw"); // 删除raw;
- m_nDelCount++;
- int pos = title.ReverseFind('\\');
- if (pos != -1)
- {
- ::DeleteFile(m_path + title.Left(pos + 1) + "s" + title.Right(title.GetLength() - pos - 1) + ".jpg"); // 删除s小图;
- ::DeleteFile(m_path + title.Left(pos + 1) + "m" + title.Right(title.GetLength() - pos - 1) + ".jpg"); // 删除m小图;
- }
- else
- {
- ::DeleteFile(m_path + "s" + title + ".jpg"); // 删除s小图
- ::DeleteFile(m_path + "m" + title + ".jpg"); // 删除m小图;
- }
- if (m_mode == 1 && g_branchname != "")
- { //拍照,加景点
- CString file2 = m_path + title;
- int pos = file2.Find(m_id);
- pos += m_id.GetLength();
- int pos2 = file2.ReverseFind('\\');
- CString jd;
- if (pos2 > pos)
- {
- jd = file2.Mid(pos + 1, pos2 - pos - 1);
- }
- CString task;
- if (jd != "")
- task = jd + "\\" + file2.Right(file2.GetLength() - pos2 - 1);
- else
- task = file2.Right(file2.GetLength() - pos2 - 1);
- delarray.Add(task);
- }
- else
- {
- delarray.Add(title);
- }
- }
- LoadPhotos();
- #if 1
- CString str;
- if (m_mode == 1)
- str += "原片";
- else if (m_mode == 2)
- str += "初修片";
- else if (m_mode == 3)
- str += "精修片";
- else if (m_mode == 5)
- str += "设计片";
- strDelContent.Format("删除%s, 订单号%s的%s:共删除%d张", m_name, m_id, str, m_nDelCount);
- WriteLog("删除相片", strDelContent);
- strDelContent = str;
- #endif
- if (delarray.GetSize() && g_branchname != "")
- {
- str.Format("是否同步删除分店 %s 的照片?", g_branchname);
- if (AfxMessageBox(str, MB_YESNO | MB_ICONSTOP) != IDYES)return;
- CString sql = "deletephotos";
- if (m_mode == 1)//拍照
- sql += "0";
- else if (m_mode == 2)//初修
- sql += "1";
- else if (m_mode == 3)//精修
- sql += "2";
- else if (m_mode == 5)//设计
- sql += "3";
- sql += m_id;
- sql += ";";
- for (int i = 0; i < delarray.GetSize(); i++)
- {
- sql += delarray.ElementAt(i);
- sql += ",";
- }
- g_sendhead.bsql = 1;
- g_pMainWnd->ProcessChatMessageRequest2(sql); if (g_bSendOK == 0)return;
- AfxMessageBox("远程删片成功!", MB_ICONINFORMATION);
- #if 1//Jeff add;
- if (m_mode == 1)
- str += "原片";
- else if (m_mode == 2)
- str += "初修片";
- else if (m_mode == 3)
- str += "精修片";
- else if (m_mode == 5)
- str += "设计片";
- strDelContent.Format("客人%s,订单号%s的分店%s的%s被同步删除", m_name, m_id, g_branchname, str);
- WriteLog("分店相片同步删除", strDelContent);
- #endif
- }
- else if (delarray.GetSize() && m_branch != "")
- {
- if (GetBranchPhotoPath(m_branch) == "")return;
- str.Format("是否同步删除分店 %s 的照片?", m_branch);
- if (AfxMessageBox(str, MB_YESNO | MB_ICONSTOP) != IDYES)return;
- CString sql = "deletephotos";
- if (m_mode == 1)//拍照
- sql += "0";
- else if (m_mode == 2)//初修
- sql += "1";
- else if (m_mode == 3)//精修
- sql += "2";
- else if (m_mode == 5)//设计
- sql += "3";
- sql += m_id;
- sql += ";";
- for (int i = 0; i < delarray.GetSize(); i++)
- {
- sql += delarray.ElementAt(i);
- sql += ",";
- }
- g_sendhead.bsql = 1;
- g_branchip = GetIP(m_branch);
- g_pMainWnd->OnDisconnect();
- g_branchname = m_branch;
- g_bBranchModify = 1;
- g_pMainWnd->ProcessChatMessageRequest2(sql);
- g_pMainWnd->OnDisconnect(); g_bBranchModify = 0; g_branchip = g_branchname = "";
- if (g_bSendOK == 0)return;
- AfxMessageBox("远程删片成功!", MB_ICONINFORMATION);
- #if 1//Jeff add;
- if (m_mode == 1)
- str += "原片";
- else if (m_mode == 2)
- str += "初修片";
- else if (m_mode == 3)
- str += "精修片";
- else if (m_mode == 5)
- str += "设计片";
- strDelContent.Format("客人%s,订单号%s的分店%s的%s被同步删除", m_name, m_id, g_branchname, str);
- WriteLog("分店相片同步删除", strDelContent);
- #endif
- }
- #endif
- }
- extern void SaveTaskPath(CString path);
- void ShowPic::OnBUTupload() //上传照片;
- {
- if (1)//g_branchname=="")
- {
- OnBUTupload2();
- return;
- }
- // ZipTypeDlg dlg;
- // dlg.DoModal ();
- CString m_sel;
- if (m_mode == 1)//拍照
- {
- m_sel = g_cominfoarraylocal.ElementAt(0).ElementAt(78);
- }
- else if (m_mode == 2)//初修
- {
- m_sel = g_cominfoarraylocal.ElementAt(0).ElementAt(79);
- }
- else if (m_mode == 3)//精修
- {
- m_sel = g_cominfoarraylocal.ElementAt(0).ElementAt(80);
- }
- else if (m_mode == 5)//设计
- {
- m_sel = g_cominfoarraylocal.ElementAt(0).ElementAt(81);
- }
- CStringArray m_uploadtaskarray;
- m_uploadtaskarray.Add(m_id + ";" + m_name);
- m_uploadtaskarray.Add("");
- m_uploadtaskarray.Add("");
- m_uploadtaskarray.Add(m_sel);
- m_uploadtaskarray.Add("");
- m_uploadtaskarray.Add("");
- m_uploadtaskarray.Add("");
- m_uploadtaskarray.Add("");
- m_uploadtaskarray.Add("");
- m_uploadtaskarray.Add("");
- MyLock lock("uploadtaskaccess");
- CFile fp;
- CString pathdir = m_path + "uploadtask";
- {
- int pos = pathdir.Find(m_id);
- pos += m_id.GetLength();
- int pos2 = pathdir.ReverseFind('\\');
- pathdir = pathdir.Left(pos) + pathdir.Right(pathdir.GetLength() - pos2);
- }
- CString path;
- int taskpos = 1;
- CStringArray m_olduploadtaskarray;
- for (int i = 0; i < 200; i++)
- {
- path.Format("%s%d.dat", pathdir, i + 1);
- if (PathFileExists(path))
- {
- CFile fp;
- if (fp.Open(path, CFile::modeRead))
- {
- DWORD length = fp.GetLength();
- if (!length)continue;
- CStringArray m_array;
- CArchive ar(&fp, CArchive::load);
- m_array.Serialize(ar);
- fp.Close();
- for (int j = 10; j < m_array.GetSize(); j += 2)
- {
- m_olduploadtaskarray.Add(m_array.ElementAt(j));
- }
- }
- }
- }
- BOOL bexist = 0;
- POSITION pos;
- pos = m_List1.GetFirstSelectedItemPosition();
- if (pos == NULL)
- {
- AfxMessageBox("请选择您要上传的文件!"); return;
- }
- else
- {
- while (pos)
- {
- int iItem = m_List1.GetNextSelectedItem(pos);
- CString title = m_List1.GetItemText(iItem, 0);
- CString file2 = m_path + title + ".jpg";
- if (m_mode == 1)
- { //拍照,加景点
- int pos = file2.Find(m_id);
- pos += m_id.GetLength();
- int pos2 = file2.ReverseFind('\\');
- CString jd;
- if (pos2 > pos)
- {
- jd = file2.Mid(pos + 1, pos2 - pos - 1);
- }
- CString task;
- if (jd != "")
- task = jd + "\\" + file2.Right(file2.GetLength() - pos2 - 1);
- else
- task = file2.Right(file2.GetLength() - pos2 - 1);
- if (::FindArray(&m_olduploadtaskarray, task) == -1)
- {
- m_uploadtaskarray.Add(task);
- m_uploadtaskarray.Add("");
- }
- else
- bexist = 1;
- }
- else
- {
- if (::FindArray(&m_olduploadtaskarray, file2.Right(file2.GetLength() - m_path.GetLength())) == -1)
- {
- m_uploadtaskarray.Add(file2.Right(file2.GetLength() - m_path.GetLength()));
- m_uploadtaskarray.Add("");
- }
- else
- bexist = 1;
- }
- }
- }
- if (m_uploadtaskarray.GetSize() > 10)
- {
- CFile fp;
- CString path;
- int taskpos = 1;
- path.Format("%s%d.dat", pathdir, taskpos);
- CString dir = path.Left(path.ReverseFind('\\') + 1);
- pathdir = g_path1 + "\\上传任务\\";
- ::CreateDirectory(pathdir, NULL);
- path.Format("%s%d.dat", pathdir, taskpos);
- while (PathFileExists(path))
- {
- taskpos++;
- path.Format("%s%d.dat", pathdir, taskpos);
- }
- fp.Open(path, CFile::modeCreate | CFile::modeWrite);
- CArchive ar(&fp, CArchive::store);
- m_uploadtaskarray.SetAt(4, dir);
- m_uploadtaskarray.Serialize(ar);
- ar.Close();
- fp.Close();
- }
- if (bexist)
- AfxMessageBox("已有存在的任务,存在的任务被忽略,保存上传任务成功!");
- else
- AfxMessageBox("保存上传任务成功!");
- }
- void ShowPic::OnBUTselall()
- {
- for (int i = 0; i < m_List1.GetItemCount(); i++)
- m_List1.SetItemState(i, LVIS_SELECTED, LVIS_SELECTED);
- }
- void ShowPic::OnSelchangeCombo2()
- {
- int pos = m_combobranch.GetCurSel();
- if (pos == -1)return;
- CString str;
- m_combobranch.GetLBText(pos, str);
- m_patharray1.RemoveAll();
- m_vFileName.RemoveAll();
- if (m_mode == 4)//礼服
- {
- m_type = str;
- LoadPhotos();
- return;
- }
- GetDlgItem(IDC_BUTupload)->SetWindowText("上传至" + str);
- GetDlgItem(IDC_BUTupload)->Invalidate();
- }
- void ShowPic::OnBUTupload2()
- {
- int combopos = m_combobranch.GetCurSel();
- if (combopos == -1)
- {
- AfxMessageBox("请选择您要上传到的分店!");
- return;
- }
- CString domain = m_iparray.ElementAt(combopos);
- CString savedomain;
- if (m_branch != "")
- {
- savedomain = GetDomainFromBranch(m_branch);
- }
- else
- {
- savedomain = GetDomainFromBranch(g_branchname);
- if (g_branchname == "")
- savedomain = g_brancharray.ElementAt(g_brancharray.GetSize() - 1).ElementAt(2);
- }
- // ZipTypeDlg dlg;
- // dlg.DoModal ();
- CString m_sel;
- if (m_mode == 1)//拍照
- {
- m_sel = g_cominfoarraylocal.ElementAt(0).ElementAt(78);
- }
- else if (m_mode == 2)//初修
- {
- m_sel = g_cominfoarraylocal.ElementAt(0).ElementAt(79);
- }
- else if (m_mode == 3)//精修
- {
- m_sel = g_cominfoarraylocal.ElementAt(0).ElementAt(80);
- }
- else if (m_mode == 5)//设计
- {
- m_sel = g_cominfoarraylocal.ElementAt(0).ElementAt(81);
- }
- CStringArray m_uploadtaskarray;
- m_uploadtaskarray.Add(m_id + ";" + m_name);
- m_uploadtaskarray.Add(domain);
- m_uploadtaskarray.Add(savedomain);
- m_uploadtaskarray.Add(m_sel);
- m_uploadtaskarray.Add("");
- m_uploadtaskarray.Add("");
- m_uploadtaskarray.Add("");
- m_uploadtaskarray.Add("");
- m_uploadtaskarray.Add("");
- m_uploadtaskarray.Add("");
- MyLock lock("uploadtaskaccess");
- CFile fp;
- CString pathdir = m_path + "uploadtask";
- {
- int pos = pathdir.Find(m_id);
- pos += m_id.GetLength();
- int pos2 = pathdir.ReverseFind('\\');
- pathdir = pathdir.Left(pos) + pathdir.Right(pathdir.GetLength() - pos2);
- }
- CString path;
- int taskpos = 1;
- CStringArray m_olduploadtaskarray;
- for (int i = 0; i < 200; i++)
- {
- path.Format("%s%d.dat", pathdir, i + 1);
- if (PathFileExists(path))
- {
- CFile fp;
- if (fp.Open(path, CFile::modeRead))
- {
- DWORD length = fp.GetLength();
- if (!length)continue;
- CStringArray m_array;
- CArchive ar(&fp, CArchive::load);
- m_array.Serialize(ar);
- fp.Close();
- if (domain != m_array.ElementAt(1))continue;
- for (int j = 10; j < m_array.GetSize(); j += 2)
- {
- m_olduploadtaskarray.Add(m_array.ElementAt(j));
- }
- }
- }
- }
- BOOL bexist = 0;
- POSITION pos;
- pos = m_List1.GetFirstSelectedItemPosition();
- if (pos == NULL)
- {
- AfxMessageBox("请选择您要上传的文件!"); return;
- }
- else
- {
- while (pos)
- {
- int iItem = m_List1.GetNextSelectedItem(pos);
- CString title = m_List1.GetItemText(iItem, 0);
- CString file2 = m_path + title + ".jpg";
- if (m_mode == 1)
- { //拍照,加景点
- int pos = file2.Find(m_id);
- pos += m_id.GetLength();
- int pos2 = file2.ReverseFind('\\');
- CString jd;
- if (pos2 > pos)
- {
- jd = file2.Mid(pos + 1, pos2 - pos - 1);
- }
- CString task;
- if (jd != "")
- task = jd + "\\" + file2.Right(file2.GetLength() - pos2 - 1);
- else
- task = file2.Right(file2.GetLength() - pos2 - 1);
- if (::FindArray(&m_olduploadtaskarray, task) == -1)
- {
- m_uploadtaskarray.Add(task);
- m_uploadtaskarray.Add("");
- }
- else
- bexist = 1;
- }
- else
- {
- if (::FindArray(&m_olduploadtaskarray, file2.Right(file2.GetLength() - m_path.GetLength())) == -1)
- {
- m_uploadtaskarray.Add(file2.Right(file2.GetLength() - m_path.GetLength()));
- m_uploadtaskarray.Add("");
- }
- else
- bexist = 1;
- }
- }
- }
- if (m_uploadtaskarray.GetSize() > 10)
- {
- CFile fp;
- CString path;
- int taskpos = 1;
- path.Format("%s%d.dat", pathdir, taskpos);
- CString dir = path.Left(path.ReverseFind('\\') + 1);
- pathdir = g_path1 + "\\上传任务\\";
- ::CreateDirectory(pathdir, NULL);
- path.Format("%s%d.dat", pathdir, taskpos);
- while (PathFileExists(path))
- {
- taskpos++;
- path.Format("%s%d.dat", pathdir, taskpos);
- }
- fp.Open(path, CFile::modeCreate | CFile::modeWrite);
- CArchive ar(&fp, CArchive::store);
- m_uploadtaskarray.SetAt(4, dir);
- m_uploadtaskarray.Serialize(ar);
- ar.Close();
- fp.Close();
- // SaveTaskPath(path);
- }
- if (bexist)
- AfxMessageBox("已有存在的任务,存在的任务被忽略,保存上传任务成功!");
- else
- AfxMessageBox("保存上传任务成功!");
- }
- void ShowPic::OnBUTSetDesignNo()
- {
- SetDesignNo dlg;
- dlg.m_id = m_id;
- dlg.DoModal();
- }
- void ShowPic::OnBUTexport() // 只有在设计时,才会有这个导出相片按钮;
- {
- if (IsHasRights2new(12) == 0)return;
- POSITION pos;
- pos = m_List1.GetFirstSelectedItemPosition();
- if (pos == NULL)
- {
- AfxMessageBox("请先选中您要导出的照片!", MB_ICONINFORMATION);
- return;
- }
- CStringArray saExportImage; // 被导出的相片路径数组;
- CString strExportDirectory; // 相片导出的路径;
- GetSavePath(strExportDirectory);
- if (strExportDirectory.IsEmpty())
- {
- return;
- }
- strExportDirectory.TrimRight('\\');
- strExportDirectory += "\\";
- strExportDirectory += m_id;
- strExportDirectory += m_name2;
- strExportDirectory += "设计好的片修";
- strExportDirectory += "\\";
- ::CreateDirectory(strExportDirectory, NULL);
- CStringArray desarray;
- CStringArray dirarray;
- CString str, str2;
- int pos2;
- while (pos)
- {
- int iItem = m_List1.GetNextSelectedItem(pos);
- str = m_List1.GetItemText(iItem, 0);
- str = m_path + str + ".jpg";
- saExportImage.Add(str);
- str2 = strExportDirectory + m_List1.GetItemText(iItem, 0) + ".jpg";
- desarray.Add(str2);
- str2 = "";
- str = m_List1.GetItemText(iItem, 0);
- pos2 = str.Find("\\");
- while (pos2 != -1)
- {
- str2 += str.Left(pos2) + "\\";
- if (::FindArray(&dirarray, str2) == -1)
- {
- dirarray.Add(str2);
- ::CreateDirectory(strExportDirectory + str2, NULL);
- }
- str = str.Right(str.GetLength() - pos2 - 1);
- pos2 = str.Find("\\");
- }
- }
- CStdioFile fp;
- fp.Open(strExportDirectory + "客户要求.txt", CFile::modeCreate | CFile::modeWrite);
- fp.WriteString(remark);
- fp.Close();
- //----------------------------------------------------------------------------------------------
- //----------------------------------------------------------------------------------------------
- // 在设计时,导出查看的设计片;
- //----------------------------------------------------------------------------------------------
- //----------------------------------------------------------------------------------------------
- ImportPhoto dlg;
- dlg.m_mode = 1; // 1.未知;
- dlg.m_pArray = &saExportImage; // 2.作为导出源的设计片的路径集合;
- dlg.m_pDesArray = &desarray; // 3.作为导出目标的设计片的路径集合;
- dlg.m_savepath = strExportDirectory; // 4.保存导出查看的设计片的目录;
- dlg.DoModal();
- AfxMessageBox("导片成功!", MB_ICONINFORMATION);
- // CString str;
- str = " 导出设计片 ";
- str += "客人:";
- str += m_name + m_id;
- WriteLog("导出设计片", str);
- }
- /************************************************************************/
- /*
- 函数:OnButRefreshPhotos
- 描述:刷新相片s和m图
- 参数:
- 返回:
- */
- /************************************************************************/
- void ShowPic::OnButRefreshPhotos()
- {
- TerminateRefreshTh();
- if(m_hRefExitEvent == NULL)
- m_hRefExitEvent = CreateEvent(NULL,TRUE,FALSE,NULL);
- unsigned int dwID = 0;
- m_hThreadRef = (HANDLE)_beginthreadex(NULL, 0, RefreshThFun, (LPVOID)this, 0/* CREATE_SUSPENDED*/, &dwID);
- }
- #if USE_SHARE_FLORD
- /************************************************************************/
- /*
- 函数:GetAllSelectImage
- 描述:获取List控件中选中的全部项;
- 参数:
- OUT: strAry,返回选中项名称;
- 返回:
- 注意:
- 调用约定:
- */
- /************************************************************************/
- void ShowPic::GetAllSelectImage(OUT CStringArray &strAry)
- {
- strAry.RemoveAll();
- POSITION pos = m_List1.GetFirstSelectedItemPosition();
- if( pos == NULL)
- {
- AfxMessageBox("请先选中您要删除的照片!", MB_ICONINFORMATION);
- return;
- }
- if( AfxMessageBox("删除后将无法恢复, 确认删除吗?", MB_YESNO|MB_ICONSTOP ) != IDYES ) return;
- int nItem = 0;
- CString strImage = _T("");
- while( pos )
- {
- nItem = m_List1.GetNextSelectedItem( pos );
- strAry.Add(m_List1.GetItemText(nItem, 0));
- }
- }
- #endif
- BOOL ShowPic::DestroyWindow()
- {
- // TODO: 在此添加专用代码和/或调用基类
- m_bExit = true;
- #ifdef _DEBUG
- TRACE("退出窗口DestroyWindow\n");
- #endif
- AutoThreadSection aSection(&m_ThreadSection);
- ExitLoadThread();
- TerminateRefreshTh();
- return CDialog::DestroyWindow();
- }
|