ShowPic3.cpp 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822
  1. // ShowPic3.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "ylgl.h"
  5. #include "ShowPic3.h"
  6. #include "ShowPic22.h"
  7. #include "JPEG.h"
  8. #include "MyLock.h"
  9. #define THUMBNAIL_WIDTH 100
  10. #define THUMBNAIL_HEIGHT 90
  11. /////////////////////////////////////////////////////////////////////////////
  12. // ShowPic3 dialog IDC_BU IDC_COMBO2 AfxMessageBox
  13. ShowPic3::ShowPic3(CWnd* pParent /*=NULL*/)
  14. : CDialog(ShowPic3::IDD, pParent)
  15. {
  16. //{{AFX_DATA_INIT(ShowPic3)
  17. //}}AFX_DATA_INIT
  18. m_bTerminate=false;
  19. m_bRunning=false;
  20. m_hThread = NULL;
  21. }
  22. void ShowPic3::DoDataExchange(CDataExchange* pDX)
  23. {
  24. CDialog::DoDataExchange(pDX);
  25. //{{AFX_DATA_MAP(ShowPic3)
  26. DDX_Control(pDX, IDC_LIST2, m_List2);
  27. DDX_Control(pDX, IDC_LIST1, m_List1);
  28. //}}AFX_DATA_MAP
  29. DDX_Control(pDX, IDC_COMBO1, m_combobox);
  30. }
  31. BEGIN_MESSAGE_MAP(ShowPic3, CDialog)
  32. //{{AFX_MSG_MAP(ShowPic3)
  33. ON_NOTIFY(NM_DBLCLK, IDC_LIST1, OnDblclkList1)
  34. ON_WM_DESTROY()
  35. ON_BN_CLICKED(IDC_BUTdelall, OnBUTdelall)
  36. ON_BN_CLICKED(IDC_BUTdel, OnBUTdel)
  37. ON_LBN_SELCHANGE(IDC_LIST2, OnSelchangeList2)
  38. ON_BN_CLICKED(IDC_BTNshow1, OnBTNshow1)
  39. ON_BN_CLICKED(IDC_BTNshow2, OnBTNshow2)
  40. ON_BN_CLICKED(IDC_BTNshow3, OnBTNshow3)
  41. ON_BN_CLICKED(IDC_BTNshow4, OnBTNshow4)
  42. ON_BN_CLICKED(IDC_BUTdel1, OnBUTdel1)
  43. ON_BN_CLICKED(IDC_BUTdel2, OnBUTdel2)
  44. ON_BN_CLICKED(IDC_BUTdel3, OnBUTdel3)
  45. ON_BN_CLICKED(IDC_BUTdel4, OnBUTdel4)
  46. //}}AFX_MSG_MAP
  47. ON_CBN_SELCHANGE(IDC_COMBO1, OnCbnSelchangeCombo1)
  48. ON_BN_CLICKED(Btn_NextOne,OnBnClickedNextone)
  49. ON_MESSAGE(OWNER_MSG_SHOWPHOTO,ShowPhoto2Found)
  50. END_MESSAGE_MAP()
  51. /////////////////////////////////////////////////////////////////////////////
  52. // ShowPic3 message handlers
  53. BOOL ShowPic3::OnInitDialog()
  54. {
  55. CDialog::OnInitDialog();
  56. CRect rc,rc2;
  57. GetWindowRect(rc2);
  58. ::MoveWindow(m_hWnd,g_rc.left,g_rc.top,g_rc.Width(),g_rc.Height(),TRUE);
  59. GetClientRect(rc);
  60. m_List2.GetWindowRect(rc2);
  61. ScreenToClient(rc2);
  62. int dt=rc2.left ;
  63. rc2.bottom =rc.bottom -dt ;
  64. m_List2.MoveWindow (rc2);
  65. m_List1.GetWindowRect(rc2);
  66. ScreenToClient(rc2);
  67. rc2.bottom =rc.bottom -dt ;
  68. rc2.right =rc.right -dt ;
  69. m_List1.MoveWindow (rc2);
  70. g_sendhead.bsql=0;
  71. g_sendhead.code[0]=217; // case 217:dindan表;
  72. g_sendhead.tabcount=1;
  73. g_pMainWnd->ProcessChatMessageRequest2(1);
  74. if(g_bSendOK==0)
  75. {
  76. CDialog::OnCancel ();
  77. return 0;
  78. }
  79. DataToArray(&g_List1array);
  80. LoadPhotos();// Jeff.获取客户原片里的所有订单文件夹名称;
  81. CString str;
  82. for(int i=0; i<g_List1array.GetSize(); i++)
  83. {
  84. str=g_List1array.ElementAt(i).ElementAt(0); // Jeff.nIndex==0,为订单号id;
  85. if(FindArray(&m_dirarray1, str)==-1)
  86. {
  87. if(FindArray(&m_dirarray2, str)==-1)
  88. {
  89. if(FindArray(&m_dirarray3, str)==-1)
  90. {
  91. if(FindArray(&m_dirarray4, str)==-1)
  92. {
  93. continue;
  94. }
  95. }
  96. }
  97. }
  98. str+="\r\n";
  99. str+=g_List1array.ElementAt(i).ElementAt(1); // Jeff.nIndex==1,为订单客户姓名1;
  100. str+=g_List1array.ElementAt(i).ElementAt(2); // Jeff.nIndex==2,为订单客户姓名2;
  101. m_strArrayName.Add(str);
  102. m_combobox.AddString(g_List1array.ElementAt(i).ElementAt(1)+g_List1array.ElementAt(i).ElementAt(2));
  103. if(m_List2.GetCount()%2)
  104. m_List2.AddEntry( str , g_gridcol1, m_List2.GetCount());
  105. else
  106. m_List2.AddEntry( str , g_gridcol2, m_List2.GetCount());
  107. }
  108. m_List2.Invalidate ();
  109. // CenterWindow();
  110. m_ImageListThumb.Create(THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT, ILC_COLOR24, 0, 1);
  111. m_List1.SetImageList(&m_ImageListThumb, LVSIL_NORMAL);
  112. return TRUE;
  113. }
  114. unsigned __stdcall LoadThumbNail20(LPVOID lpParam)
  115. {
  116. try
  117. {
  118. ShowPic3 *pDlg=(ShowPic3*)lpParam;
  119. CListCtrl *ListCtrl=&pDlg->m_List1;
  120. CImageList* pImgList=&pDlg->m_ImageListThumb;
  121. // reset our image list
  122. for(int i=0; i<pImgList->GetImageCount(); i++)
  123. pImgList->Remove(i);
  124. // remove all items from list view
  125. ListCtrl->DeleteAllItems();
  126. pImgList->SetImageCount(pDlg->m_vFileName.size());
  127. TCHAR path[MAX_PATH];
  128. vector<CString>::iterator iter;
  129. // Set redraw to FALSE to avoid flickering during adding new items
  130. ListCtrl->SetRedraw(FALSE);
  131. int nIndex=0;
  132. CString str, spath;
  133. for(iter=pDlg->m_vFileName.begin(); iter!=pDlg->m_vFileName.end() && pDlg->m_bTerminate!=true; iter++, nIndex++)
  134. {
  135. str=*iter;
  136. spath.Empty ();
  137. if(str.Left (str.ReverseFind ('\\')+1)!=pDlg->m_path)
  138. {
  139. spath=str.Left (str.ReverseFind ('\\')+1);
  140. spath= spath.Right (spath.GetLength ()-pDlg->m_path.GetLength ());
  141. }
  142. str=str.Right (str.GetLength ()-str.ReverseFind ('\\')-1);
  143. str=spath+str.Left (str.GetLength ()-4);
  144. ListCtrl->InsertItem(nIndex, str, nIndex);
  145. }
  146. ListCtrl->SetRedraw(TRUE);
  147. ListCtrl->Invalidate();
  148. const float fRatio=(float)THUMBNAIL_HEIGHT/THUMBNAIL_WIDTH;
  149. int XDest, YDest, nDestWidth, nDestHeight;
  150. nIndex=0;
  151. SolidBrush whitebrush(Color(255,255,255,255));
  152. for(iter=pDlg->m_vFileName.begin(); iter!=pDlg->m_vFileName.end() && pDlg->m_bTerminate!=true; iter++, nIndex++)
  153. {
  154. // Load Image File
  155. Image *image=NULL;
  156. Bitmap *pBmp=NULL;
  157. str=*iter;
  158. spath=str.Left (str.ReverseFind ('\\')+1);
  159. spath+="s";
  160. spath+=str.Right (str.GetLength ()-str.ReverseFind ('\\')-1);
  161. if(::CheckFileExist (spath))
  162. ::LoadImageFromBuf (&image, spath);
  163. else
  164. {
  165. str.MakeLower();
  166. if(str.Right(3)!="jpg")continue;
  167. ::LoadImageFromBuf (&image, str);
  168. }
  169. if(image==NULL)continue;
  170. int orientation=GetOrientation(image);
  171. if(orientation==8)
  172. image->RotateFlip( Rotate270FlipNone );
  173. else if(orientation==6)
  174. image->RotateFlip( Rotate90FlipNone );
  175. if(image->GetWidth()==0)
  176. continue;
  177. // Calculate Rect to fit to canvas
  178. const float fImgRatio=(float)image->GetHeight()/image->GetWidth();
  179. if(fImgRatio > fRatio)
  180. {
  181. nDestWidth=THUMBNAIL_HEIGHT/fImgRatio;
  182. XDest=(THUMBNAIL_WIDTH-nDestWidth)/2;
  183. YDest=0;
  184. nDestHeight=THUMBNAIL_HEIGHT;
  185. }
  186. else
  187. {
  188. XDest=0;
  189. nDestWidth=THUMBNAIL_WIDTH;
  190. nDestHeight=THUMBNAIL_WIDTH*fImgRatio;
  191. YDest=(THUMBNAIL_HEIGHT-nDestHeight)/2;
  192. }
  193. pBmp=new Bitmap(THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT, PixelFormat24bppRGB );
  194. Graphics graph2(pBmp);
  195. graph2.Clear(Color(255,192,192,192));
  196. graph2.FillRectangle (&whitebrush,1, 1, THUMBNAIL_WIDTH-2, THUMBNAIL_HEIGHT-2);
  197. Graphics graph(pBmp);
  198. Rect desRect(XDest, YDest, nDestWidth, nDestHeight);
  199. // Draw Image
  200. graph.DrawImage(image, desRect, 0,0,image->GetWidth(),image->GetHeight(),UnitPixel);
  201. delete image;
  202. // Attach to Bitmap and Replace image in CImageList
  203. CBitmap bitmap;
  204. HBITMAP hbmp;
  205. pBmp->GetHBITMAP(Color(255,255,255,255), &hbmp);
  206. bitmap.Attach(hbmp);
  207. pImgList->Replace(nIndex, &bitmap, NULL);
  208. delete pBmp;
  209. // Redraw only a current item for removing flickering and fast speed.
  210. ListCtrl->RedrawItems(nIndex, nIndex);
  211. // Release used DC and Object
  212. }
  213. ListCtrl->Invalidate();
  214. pDlg->m_bRunning=false;
  215. pDlg->m_bTerminate=false;
  216. _endthreadex( 0 );
  217. return 0;
  218. }
  219. catch(...)
  220. {
  221. }
  222. }
  223. void ShowPic3::LoadThumbImages()
  224. {
  225. TerminateThread();
  226. m_hThread = (HANDLE)_beginthreadex(NULL,0, LoadThumbNail20,(LPVOID)this,0/* CREATE_SUSPENDED*/,&m_dwThreadID);
  227. m_bRunning=true;
  228. }
  229. BOOL ShowPic3::TerminateThread()
  230. {
  231. if ( !m_bRunning )
  232. return TRUE;
  233. m_bTerminate=true;
  234. for( ; ; )
  235. {
  236. if ( ::WaitForSingleObject(m_hThread, 0) == WAIT_OBJECT_0 )
  237. break;
  238. MSG msg;
  239. while (::PeekMessage(&msg,NULL,0,0,PM_NOREMOVE))
  240. {
  241. if (!AfxGetApp()->PumpMessage())
  242. break;
  243. }
  244. }
  245. ::CloseHandle(m_hThread);
  246. return TRUE;
  247. }
  248. void ShowPic3::OnDblclkList1(NMHDR* pNMHDR, LRESULT* pResult)
  249. {
  250. // TODO: Add your control notification handler code here
  251. POSITION pos;
  252. pos=m_List1.GetFirstSelectedItemPosition();
  253. if(pos==NULL)
  254. {
  255. return;
  256. }
  257. int iItem=m_List1.GetNextSelectedItem(pos);
  258. ShowPic22 dlg;
  259. dlg.m_pos=iItem;
  260. dlg.m_pPathArray=&m_patharray1;
  261. dlg.DoModal ();
  262. *pResult = 0;
  263. }
  264. void ShowPic3::OnDestroy()
  265. {
  266. TerminateThread();
  267. CDialog::OnDestroy();
  268. // TODO: Add your message handler code here
  269. }
  270. void ShowPic3::LoadPhotos()
  271. {
  272. CString str;
  273. if(1)
  274. {
  275. // printf("Jeff:g_path1=%s\n\n",g_path1);//Jeff.获取客户原片里的所有订单文件夹名称;
  276. using namespace helper_coffs;
  277. ffsco o;
  278. o.dirs(0);
  279. o.find(LPCSTR(g_path1), LPCSTR("*.*"));
  280. ffsco::typeT coo;
  281. ffsco::typeT::iterator it;
  282. coo = o.co_dir();
  283. for (it = coo.begin(); coo.end() != it; it ++)
  284. {
  285. str=(*it).c_str();
  286. if(str==g_path1+"\\")continue;
  287. str.TrimRight ("\\");
  288. str=str.Right (str.GetLength ()-str.ReverseFind ('\\')-1);
  289. // printf("Jeff:str=%s\n\n",str);
  290. m_dirarray1.Add (str);
  291. }
  292. }
  293. return;
  294. if(1)
  295. {
  296. using namespace helper_coffs;
  297. ffsco o;
  298. o.dirs(0);
  299. o.find(LPCSTR(g_path2), LPCSTR("*.*"));
  300. ffsco::typeT coo;
  301. ffsco::typeT::iterator it;
  302. coo = o.co_dir();
  303. for (it = coo.begin(); coo.end() != it; it ++)
  304. {
  305. str=(*it).c_str();
  306. if(str==g_path2+"\\")continue;
  307. str.TrimRight ("\\");
  308. str=str.Right (str.GetLength ()-str.ReverseFind ('\\')-1);
  309. m_dirarray2.Add (str);
  310. }
  311. }
  312. if(1)
  313. {
  314. using namespace helper_coffs;
  315. ffsco o;
  316. o.dirs(0);
  317. o.find(LPCSTR(g_path3), LPCSTR("*.*"));
  318. ffsco::typeT coo;
  319. ffsco::typeT::iterator it;
  320. coo = o.co_dir();
  321. for (it = coo.begin(); coo.end() != it; it ++)
  322. {
  323. str=(*it).c_str();
  324. if(str==g_path3+"\\")continue;
  325. str.TrimRight ("\\");
  326. str=str.Right (str.GetLength ()-str.ReverseFind ('\\')-1);
  327. m_dirarray3.Add (str);
  328. }
  329. }
  330. if(1)
  331. {
  332. using namespace helper_coffs;
  333. ffsco o;
  334. o.dirs(0);
  335. o.find(LPCSTR(g_path4), LPCSTR("*.*"));
  336. ffsco::typeT coo;
  337. ffsco::typeT::iterator it;
  338. coo = o.co_dir();
  339. for (it = coo.begin(); coo.end() != it; it ++)
  340. {
  341. str=(*it).c_str();
  342. if(str==g_path4+"\\")continue;
  343. str.TrimRight ("\\");
  344. str=str.Right (str.GetLength ()-str.ReverseFind ('\\')-1);
  345. m_dirarray4.Add (str);
  346. }
  347. }
  348. return;
  349. }
  350. void ShowPic3::OnBUTdel()
  351. {
  352. }
  353. void ShowPic3::OnSelchangeList2()
  354. {
  355. // TODO: Add your control notification handler code here
  356. UpdateData();
  357. int pos=m_List2.GetCurSel();
  358. if(pos==-1)return;
  359. CString str;
  360. m_List2.GetText(pos, str);
  361. pos=str.Find("\r\n");
  362. if(pos==-1)return;;
  363. m_strOrderNumber = str.Left(pos);
  364. // printf("Jeff:欲显示的订单号=%s\n\n",m_strOrderNumber);
  365. ShowPhoto1();
  366. if(m_patharray1.GetSize()==0)OnBTNshow2();
  367. if(m_patharray1.GetSize()==0)OnBTNshow3();
  368. if(m_patharray1.GetSize()==0)OnBTNshow4();
  369. }
  370. void ShowPic3::ShowPhoto1()
  371. {
  372. if(m_strOrderNumber=="")
  373. {
  374. AfxMessageBox("请先选中客人!", MB_ICONINFORMATION);return;
  375. }
  376. CString str;
  377. m_path=g_path1+"\\"+m_strOrderNumber+"\\";
  378. m_patharray1.RemoveAll();
  379. if(1)
  380. {
  381. using namespace helper_coffs;
  382. ffsco o;
  383. o.dirs(1);
  384. o.find(LPCSTR(m_path), LPCSTR("*.jpg"));
  385. ffsco::typeT coo;
  386. ffsco::typeT::iterator it;
  387. coo = o.co_file();
  388. for (it = coo.begin(); coo.end() != it; it ++)
  389. {
  390. str=(*it).c_str();
  391. if(str.GetAt(str.ReverseFind ('\\')+1)=='s')continue;
  392. if(str.GetAt(str.ReverseFind ('\\')+1)=='m')continue;
  393. str.MakeLower();
  394. m_patharray1.Add(str);
  395. }
  396. }
  397. if(m_bRunning)return;
  398. CStringArray *pArray=&m_patharray1;
  399. m_vFileName.clear();
  400. for(int i=0; i<pArray->GetSize(); i++)
  401. {
  402. CString filePath=pArray->ElementAt(i);
  403. filePath.MakeLower();
  404. m_vFileName.push_back(filePath);
  405. }
  406. LoadThumbImages();
  407. }
  408. void ShowPic3::ShowPhoto2()
  409. {
  410. if(m_strOrderNumber=="")
  411. {
  412. AfxMessageBox("请先选中客人!", MB_ICONINFORMATION);return;
  413. }
  414. CString str;
  415. m_path=g_path2+"\\"+m_strOrderNumber+"\\";
  416. m_patharray1.RemoveAll ();
  417. if(1)
  418. {
  419. using namespace helper_coffs;
  420. ffsco o;
  421. o.dirs(1);
  422. o.find(LPCSTR(m_path), LPCSTR("*.jpg"));
  423. ffsco::typeT coo;
  424. ffsco::typeT::iterator it;
  425. coo = o.co_file();
  426. for (it = coo.begin(); coo.end() != it; it ++)
  427. {
  428. str=(*it).c_str();
  429. if(str.GetAt (str.ReverseFind ('\\')+1)=='s')continue;
  430. if(str.GetAt (str.ReverseFind ('\\')+1)=='m')continue;
  431. str.MakeLower ();
  432. m_patharray1.Add (str);
  433. }
  434. }
  435. if(m_bRunning)return;
  436. CStringArray *pArray=&m_patharray1;
  437. m_vFileName.clear();
  438. for(int i=0; i<pArray->GetSize (); i++)
  439. {
  440. CString filePath=pArray->ElementAt (i);
  441. filePath.MakeLower();
  442. m_vFileName.push_back(filePath);
  443. }
  444. LoadThumbImages();
  445. }
  446. void ShowPic3::ShowPhoto3()
  447. {
  448. if(m_strOrderNumber=="")
  449. {
  450. AfxMessageBox("请先选中客人!", MB_ICONINFORMATION);return;
  451. }
  452. CString str;
  453. m_path=g_path3+"\\"+m_strOrderNumber+"\\";
  454. m_patharray1.RemoveAll ();
  455. if(1)
  456. {
  457. using namespace helper_coffs;
  458. ffsco o;
  459. o.dirs(1);
  460. o.find(LPCSTR(m_path), LPCSTR("*.jpg"));
  461. ffsco::typeT coo;
  462. ffsco::typeT::iterator it;
  463. coo = o.co_file();
  464. for (it = coo.begin(); coo.end() != it; it ++)
  465. {
  466. str=(*it).c_str();
  467. if(str.GetAt (str.ReverseFind ('\\')+1)=='s')continue;
  468. if(str.GetAt (str.ReverseFind ('\\')+1)=='m')continue;
  469. str.MakeLower ();
  470. m_patharray1.Add (str);
  471. }
  472. }
  473. if(m_bRunning)return;
  474. CStringArray *pArray=&m_patharray1;
  475. m_vFileName.clear();
  476. for(int i=0; i<pArray->GetSize (); i++)
  477. {
  478. CString filePath=pArray->ElementAt (i);
  479. filePath.MakeLower();
  480. m_vFileName.push_back(filePath);
  481. }
  482. LoadThumbImages();
  483. }
  484. void ShowPic3::ShowPhoto4()
  485. {
  486. if(m_strOrderNumber=="")
  487. {
  488. AfxMessageBox("请先选中客人!", MB_ICONINFORMATION);return;
  489. }
  490. CString str;
  491. m_path=g_path4+"\\"+m_strOrderNumber+"\\";
  492. m_patharray1.RemoveAll ();
  493. if(1)
  494. {
  495. using namespace helper_coffs;
  496. ffsco o;
  497. o.dirs(1);
  498. o.find(LPCSTR(m_path), LPCSTR("*.jpg"));
  499. ffsco::typeT coo;
  500. ffsco::typeT::iterator it;
  501. coo = o.co_file();
  502. for (it = coo.begin(); coo.end() != it; it ++)
  503. {
  504. str=(*it).c_str();
  505. if(str.GetAt (str.ReverseFind ('\\')+1)=='s')continue;
  506. if(str.GetAt (str.ReverseFind ('\\')+1)=='m')continue;
  507. str.MakeLower ();
  508. m_patharray1.Add (str);
  509. }
  510. }
  511. if(m_bRunning)return;
  512. CStringArray *pArray=&m_patharray1;
  513. m_vFileName.clear();
  514. for(int i=0; i<pArray->GetSize (); i++)
  515. {
  516. CString filePath=pArray->ElementAt (i);
  517. filePath.MakeLower();
  518. m_vFileName.push_back(filePath);
  519. }
  520. LoadThumbImages();
  521. }
  522. void ShowPic3::OnBTNshow1()
  523. {
  524. // TODO: Add your control notification handler code here
  525. ShowPhoto1();
  526. }
  527. void ShowPic3::OnBTNshow2()
  528. {
  529. // TODO: Add your control notification handler code here
  530. ShowPhoto2();
  531. }
  532. void ShowPic3::OnBTNshow3()
  533. {
  534. // TODO: Add your control notification handler code here
  535. ShowPhoto4();
  536. }
  537. void ShowPic3::OnBTNshow4()
  538. {
  539. // TODO: Add your control notification handler code here
  540. ShowPhoto3();
  541. }
  542. void ShowPic3::OnBUTdelall()
  543. {
  544. // TODO: Add your control notification handler code here
  545. if(m_strOrderNumber=="")
  546. {
  547. AfxMessageBox("请先选中您要删除的客人!", MB_ICONINFORMATION);return;
  548. }
  549. if(AfxMessageBox("删除后将无法恢复, 确认删除吗?", MB_YESNO|MB_ICONSTOP)!=IDYES)return;
  550. DeleteDirectory(g_path1+"\\"+m_strOrderNumber+"\\");
  551. DeleteDirectory(g_path2+"\\"+m_strOrderNumber+"\\");
  552. DeleteDirectory(g_path3+"\\"+m_strOrderNumber+"\\");
  553. DeleteDirectory(g_path4+"\\"+m_strOrderNumber+"\\");
  554. OnBTNshow1();
  555. }
  556. void ShowPic3::OnBUTdel1()
  557. {
  558. // TODO: Add your control notification handler code here
  559. if(m_strOrderNumber=="")
  560. {
  561. AfxMessageBox("请先选中您要删除的客人!", MB_ICONINFORMATION);return;
  562. }
  563. if(AfxMessageBox("删除后将无法恢复, 确认删除吗?", MB_YESNO|MB_ICONSTOP)!=IDYES)return;
  564. DeleteDirectory(g_path1+"\\"+m_strOrderNumber+"\\"); OnBTNshow1();
  565. }
  566. void ShowPic3::OnBUTdel2()
  567. {
  568. // TODO: Add your control notification handler code here
  569. if(m_strOrderNumber=="")
  570. {
  571. AfxMessageBox("请先选中您要删除的客人!", MB_ICONINFORMATION);return;
  572. }
  573. if(AfxMessageBox("删除后将无法恢复, 确认删除吗?", MB_YESNO|MB_ICONSTOP)!=IDYES)return;
  574. DeleteDirectory(g_path2+"\\"+m_strOrderNumber+"\\"); OnBTNshow2();
  575. }
  576. void ShowPic3::OnBUTdel3()
  577. {
  578. // TODO: Add your control notification handler code here
  579. if(m_strOrderNumber=="")
  580. {
  581. AfxMessageBox("请先选中您要删除的客人!", MB_ICONINFORMATION);return;
  582. }
  583. if(AfxMessageBox("删除后将无法恢复, 确认删除吗?", MB_YESNO|MB_ICONSTOP)!=IDYES)return;
  584. DeleteDirectory(g_path4+"\\"+m_strOrderNumber+"\\"); OnBTNshow3();
  585. }
  586. void ShowPic3::OnBUTdel4()
  587. {
  588. // TODO: Add your control notification handler code here
  589. if(m_strOrderNumber=="")
  590. {
  591. AfxMessageBox("请先选中您要删除的客人!", MB_ICONINFORMATION);return;
  592. }
  593. if(AfxMessageBox("删除后将无法恢复, 确认删除吗?", MB_YESNO|MB_ICONSTOP)!=IDYES)return;
  594. DeleteDirectory(g_path3+"\\"+m_strOrderNumber+"\\"); OnBTNshow4();
  595. }
  596. void ShowPic3::OnCbnSelchangeCombo1()
  597. {
  598. static int nIndex = 0;
  599. if(nIndex)
  600. m_List2.SetSel(nIndex,FALSE);
  601. int i = 0;
  602. int nSelCount = m_List2.GetSelCount();
  603. for ( i = 0; i < nSelCount; i++)//去除还处于选择状态的项;
  604. {
  605. int nSelItem;
  606. m_List2.GetSelItems(nSelCount,&nSelItem);
  607. m_List2.SetSel(nSelItem,FALSE);
  608. }
  609. int nPos = m_combobox.GetCurSel();
  610. CString strName;
  611. //m_combobox.GetWindowText(strName);
  612. m_combobox.GetLBText(nPos,strName);
  613. // printf("Jeff:****当前查找内容=%s\n\n",strName);
  614. int nSize = m_strArrayName.GetSize();
  615. for ( i = 0; i < nSize; i++)
  616. {
  617. CString str = m_strArrayName.ElementAt(i);
  618. if ( str.Find(strName) != -1)
  619. {
  620. // printf("Jeff:****当前查找内容=%s\n\n",str);
  621. //nIndex = m_List2.SelectString(-1,str);
  622. nIndex = i;
  623. if ( nIndex == LB_ERR)
  624. {
  625. AfxMessageBox("Jeff:789");
  626. break;
  627. }
  628. m_List2.SetSel(nIndex,TRUE);
  629. PostMessage(OWNER_MSG_SHOWPHOTO,nIndex);
  630. break;
  631. }
  632. }
  633. }
  634. void ShowPic3::OnBnClickedNextone()
  635. {
  636. static int nIndex = 0;
  637. static CString strOld = "";
  638. m_List2.SetSel(nIndex-1,FALSE);
  639. int i = 0;
  640. int nSelCount = m_List2.GetSelCount();
  641. for ( i = 0; i < nSelCount; i++)//去除还处于选择状态的项;
  642. {
  643. int nSelItem;
  644. m_List2.GetSelItems(nSelCount,&nSelItem);
  645. m_List2.SetSel(nSelItem,FALSE);
  646. }
  647. CString strFind ="";
  648. m_combobox.GetWindowText(strFind);
  649. if ( strOld != strFind )
  650. {
  651. strOld = strFind;
  652. nIndex = 0;
  653. }
  654. // printf("Jeff:当前查找内容=%s\n\n",strFind);
  655. CString str;
  656. BOOL bFind = FALSE;
  657. int nSize = m_strArrayName.GetSize();
  658. for ( i = nIndex; i < nSize; i++)
  659. {
  660. str = m_strArrayName.ElementAt(i);
  661. // printf("Jeff:匹配内容=%s\n\n",str);
  662. if ( str.Find(strFind) != -1)
  663. {
  664. nIndex = i;
  665. // printf("Jeff:nIndex=%d,找到内容=%s\n\n",i,str);
  666. bFind = TRUE;
  667. break;
  668. }
  669. }
  670. if ( bFind == FALSE )
  671. {
  672. nIndex = 0;
  673. AfxMessageBox("未找到查找匹配的内容,将再次从头开始查找");
  674. }
  675. else
  676. {
  677. m_List2.SetSel(nIndex++,TRUE);
  678. PostMessage(OWNER_MSG_SHOWPHOTO,-1);
  679. }
  680. }
  681. #ifdef VC60
  682. void ShowPic3::ShowPhoto2Found(WPARAM wParam,LPARAM lParam)
  683. {
  684. UpdateData();
  685. int nPos = m_List2.GetCurSel();
  686. if(wParam != -1)
  687. nPos = wParam;
  688. if(nPos == -1) return;
  689. CString str;
  690. m_List2.GetText(nPos, str);
  691. nPos = str.Find("\r\n");
  692. if(nPos == -1)return;;
  693. m_strOrderNumber = str.Left(nPos);
  694. // printf("Jeff:欲显示的订单号=%s\n\n",m_strOrderNumber);
  695. ShowPhoto1();
  696. if(m_patharray1.GetSize()==0)OnBTNshow2();
  697. if(m_patharray1.GetSize()==0)OnBTNshow3();
  698. if(m_patharray1.GetSize()==0)OnBTNshow4();
  699. }
  700. #else
  701. LRESULT ShowPic3::ShowPhoto2Found(WPARAM wParam,LPARAM lParam)
  702. {
  703. UpdateData();
  704. int nPos = m_List2.GetCurSel();
  705. if(wParam != -1)
  706. nPos = wParam;
  707. if(nPos == -1) return 0;
  708. CString str;
  709. m_List2.GetText(nPos, str);
  710. nPos = str.Find("\r\n");
  711. if(nPos == -1)return 0;
  712. m_strOrderNumber = str.Left(nPos);
  713. // printf("Jeff:欲显示的订单号=%s\n\n",m_strOrderNumber);
  714. ShowPhoto1();
  715. if(m_patharray1.GetSize()==0)OnBTNshow2();
  716. if(m_patharray1.GetSize()==0)OnBTNshow3();
  717. if(m_patharray1.GetSize()==0)OnBTNshow4();
  718. return 0;
  719. }
  720. #endif