ShowCut.cpp 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640
  1. // ShowCut.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "ylgl.h"
  5. #include "ShowCut.h"
  6. #include "JPEG.h"
  7. #include "MyLock.h"
  8. #include "ShowPhoto.h"
  9. #define THUMBNAIL_WIDTH 100
  10. #define THUMBNAIL_HEIGHT 90
  11. ShowCut::ShowCut(CWnd* pParent /*=NULL*/): CDialog(ShowCut::IDD, pParent)
  12. {
  13. m_bTerminate = false;
  14. m_bRunning = false;
  15. m_hThread = NULL;
  16. m_mode = 0;
  17. }
  18. void ShowCut::DoDataExchange(CDataExchange* pDX)
  19. {
  20. CDialog::DoDataExchange(pDX);
  21. DDX_Control(pDX, IDC_LIST1, m_List1);
  22. DDX_Control(pDX, IDC_COMBO1, m_combo1);
  23. }
  24. BEGIN_MESSAGE_MAP(ShowCut, CDialog)
  25. ON_WM_DESTROY()
  26. ON_BN_CLICKED(IDC_BUTdelall, OnBUTdelall)
  27. ON_BN_CLICKED(IDC_BUTdel, OnBUTdel)
  28. ON_NOTIFY(NM_DBLCLK, IDC_LIST1, OnDblclkList1)
  29. END_MESSAGE_MAP()
  30. /////////////////////////////////////////////////////////////////////////////
  31. // ShowCut message handlers
  32. BOOL ShowCut::OnInitDialog()
  33. {
  34. CDialog::OnInitDialog();
  35. CRect rc2;
  36. GetWindowRect(rc2);
  37. ::MoveWindow(m_hWnd, g_rc.left, g_rc.top, g_rc.Width(), g_rc.Height(), TRUE);
  38. EnumChildWindows(m_hWnd, (WNDENUMPROC)EnumChildProc, 0);
  39. GetClientRect(rc2);
  40. if (m_mode == 0)
  41. rc2.top += 35 * g_fscaley;
  42. else
  43. {
  44. GetDlgItem(IDC_BUTdelall)->ShowWindow(0);
  45. GetDlgItem(IDC_BUTdel)->ShowWindow(0);
  46. GetDlgItem(IDOK)->ShowWindow(0);
  47. }
  48. m_List1.MoveWindow(rc2);
  49. int right = rc2.right;
  50. GetDlgItem(IDOK)->GetWindowRect(rc2);
  51. ScreenToClient(rc2);
  52. int hei = rc2.Height();
  53. int dtx = right - rc2.right - 5;
  54. rc2.top = 5;
  55. rc2.bottom = rc2.top + hei;
  56. rc2.left += dtx;
  57. rc2.right += dtx;
  58. GetDlgItem(IDOK)->MoveWindow(rc2);
  59. GetDlgItem(IDC_BUTdel)->GetWindowRect(rc2);
  60. ScreenToClient(rc2);
  61. rc2.top = 5;
  62. rc2.bottom = rc2.top + hei;
  63. rc2.left += dtx;
  64. rc2.right += dtx;
  65. GetDlgItem(IDC_BUTdel)->MoveWindow(rc2);
  66. GetDlgItem(IDC_BUTdelall)->GetWindowRect(rc2);
  67. ScreenToClient(rc2);
  68. rc2.top = 5;
  69. rc2.bottom = rc2.top + hei;
  70. rc2.left += dtx;
  71. rc2.right += dtx;
  72. GetDlgItem(IDC_BUTdelall)->MoveWindow(rc2);
  73. if (GetSize() == 0)
  74. {
  75. CDialog::OnCancel();
  76. return 0;
  77. }
  78. if (g_bAllBranch)
  79. {
  80. CString branchpath = GetBranchPhotoPath(m_branch);
  81. m_path = g_path1 + branchpath + "\\";
  82. }
  83. else
  84. m_path = g_path1 + "\\";
  85. m_path += m_id;
  86. m_path += "\\";
  87. m_ImageListThumb.Create(THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT, ILC_COLOR24, 0, 1);
  88. m_List1.SetImageList(&m_ImageListThumb, LVSIL_NORMAL);
  89. LoadPhotos();
  90. return TRUE;
  91. }
  92. unsigned __stdcall LoadThumbNail15(LPVOID lpParam)
  93. {
  94. try
  95. {
  96. ShowCut *pDlg = (ShowCut*)lpParam;
  97. CListCtrl *ListCtrl = &pDlg->m_List1;
  98. CImageList* pImgList = &pDlg->m_ImageListThumb;
  99. // reset our image list
  100. for (int i = 0; i < pImgList->GetImageCount(); i++)
  101. pImgList->Remove(i);
  102. // remove all items from list view
  103. ListCtrl->DeleteAllItems();
  104. pImgList->SetImageCount(pDlg->m_vFileName.size());
  105. TCHAR path[MAX_PATH];
  106. vector<CString>::iterator iter;
  107. // Set redraw to FALSE to avoid flickering during adding new items
  108. ListCtrl->SetRedraw(FALSE);
  109. int nIndex = 0;
  110. CString str, spath;
  111. for (iter = pDlg->m_vFileName.begin(); iter != pDlg->m_vFileName.end() && pDlg->m_bTerminate != true; iter++, nIndex++)
  112. {
  113. /* str=*iter;
  114. spath.Empty ();
  115. if(str.Left (str.ReverseFind ('\\')+1)!=pDlg->m_path)
  116. {
  117. spath=str.Left (str.ReverseFind ('\\')+1);
  118. spath= spath.Right (spath.GetLength ()-pDlg->m_path.GetLength ());
  119. }
  120. str=str.Right (str.GetLength ()-str.ReverseFind ('\\')-1);
  121. str=spath+str.Left (str.GetLength ()-4);*/
  122. ListCtrl->InsertItem(nIndex, pDlg->m_titlearray.ElementAt(nIndex), nIndex);
  123. // ListCtrl->InsertItem(nIndex, str, nIndex);
  124. }
  125. ListCtrl->SetRedraw(TRUE);
  126. ListCtrl->Invalidate();
  127. const float fRatio = (float)THUMBNAIL_HEIGHT / THUMBNAIL_WIDTH;
  128. int XDest, YDest, nDestWidth, nDestHeight;
  129. nIndex = 0;
  130. SolidBrush whitebrush(Color(255, 255, 255, 255));
  131. for (iter = pDlg->m_vFileName.begin(); iter != pDlg->m_vFileName.end() && pDlg->m_bTerminate != true; iter++, nIndex++)
  132. {
  133. // Load Image File
  134. Image *image = NULL;
  135. Bitmap *pBmp = NULL;
  136. str = *iter;
  137. spath = str.Left(str.ReverseFind('\\') + 1);
  138. spath += "s";
  139. spath += str.Right(str.GetLength() - str.ReverseFind('\\') - 1);
  140. if (PathFileExists(spath))
  141. ::LoadImageFromBuf(&image, spath);
  142. else
  143. ::LoadImageFromBuf(&image, str);
  144. int orientation = GetOrientation(image);
  145. if (orientation == 8)
  146. image->RotateFlip(Rotate270FlipNone);
  147. else if (orientation == 6)
  148. image->RotateFlip(Rotate90FlipNone);
  149. if (image->GetWidth() == 0)
  150. continue;
  151. // Calculate Rect to fit to canvas
  152. const float fImgRatio = (float)image->GetHeight() / image->GetWidth();
  153. if (fImgRatio > fRatio)
  154. {
  155. nDestWidth = THUMBNAIL_HEIGHT / fImgRatio;
  156. XDest = (THUMBNAIL_WIDTH - nDestWidth) / 2;
  157. YDest = 0;
  158. nDestHeight = THUMBNAIL_HEIGHT;
  159. }
  160. else
  161. {
  162. XDest = 0;
  163. nDestWidth = THUMBNAIL_WIDTH;
  164. nDestHeight = THUMBNAIL_WIDTH*fImgRatio;
  165. YDest = (THUMBNAIL_HEIGHT - nDestHeight) / 2;
  166. }
  167. pBmp = new Bitmap(THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT, PixelFormat24bppRGB);
  168. Graphics graph2(pBmp);
  169. graph2.Clear(Color(255, 192, 192, 192));
  170. graph2.FillRectangle(&whitebrush, 1, 1, THUMBNAIL_WIDTH - 2, THUMBNAIL_HEIGHT - 2);
  171. Graphics graph(pBmp);
  172. Rect desRect(XDest, YDest, nDestWidth, nDestHeight);
  173. // Draw Image
  174. graph.DrawImage(image, desRect, 0, 0, image->GetWidth(), image->GetHeight(), UnitPixel);
  175. float scale = (float)nDestWidth / (float)image->GetWidth();
  176. int pos = pDlg->FindArray2(pDlg->m_titlearray.ElementAt(nIndex));
  177. if (pos != -1)
  178. {
  179. int nIndex = pos;
  180. CRect rc = pDlg->m_rcarray.ElementAt(nIndex);
  181. int wid = pDlg->m_widtharray.ElementAt(nIndex).left;
  182. int hei = pDlg->m_widtharray.ElementAt(nIndex).top;
  183. scale *= (float)image->GetWidth() / (float)wid;
  184. rc.left *= scale;
  185. rc.right *= scale;
  186. rc.top *= scale;
  187. rc.bottom *= scale;
  188. rc.left += XDest;
  189. rc.right += XDest;
  190. rc.top += YDest;
  191. rc.bottom += YDest;
  192. Pen blackPen(Color(255, 255, 0, 0), 1);
  193. graph.DrawRectangle(&blackPen, rc.left, rc.top, rc.Width(), rc.Height());
  194. }
  195. delete image;
  196. // Attach to Bitmap and Replace image in CImageList
  197. CBitmap bitmap;
  198. HBITMAP hbmp;
  199. pBmp->GetHBITMAP(Color(255, 255, 255, 255), &hbmp);
  200. bitmap.Attach(hbmp);
  201. pImgList->Replace(nIndex, &bitmap, NULL);
  202. delete pBmp;
  203. // Redraw only a current item for removing flickering and fast speed.
  204. ListCtrl->RedrawItems(nIndex, nIndex);
  205. // Release used DC and Object
  206. }
  207. ListCtrl->Invalidate();
  208. pDlg->m_bRunning = false;
  209. pDlg->m_bTerminate = false;
  210. _endthreadex(0);
  211. return 0;
  212. }
  213. catch (...)
  214. {
  215. }
  216. }
  217. void ShowCut::LoadThumbImages()
  218. {
  219. TerminateThread();
  220. m_hThread = (HANDLE)_beginthreadex(NULL, 0, LoadThumbNail15, (LPVOID)this, 0/* CREATE_SUSPENDED*/, &m_dwThreadID);
  221. m_bRunning = true;
  222. }
  223. BOOL ShowCut::TerminateThread()
  224. {
  225. if (!m_bRunning)
  226. return TRUE;
  227. m_bTerminate = true;
  228. for (;;)
  229. {
  230. if (::WaitForSingleObject(m_hThread, 0) == WAIT_OBJECT_0)
  231. break;
  232. MSG msg;
  233. while (::PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE))
  234. {
  235. if (!AfxGetApp()->PumpMessage())
  236. break;
  237. }
  238. }
  239. ::CloseHandle(m_hThread);
  240. return TRUE;
  241. }
  242. void ShowCut::OnDestroy()
  243. {
  244. TerminateThread();
  245. CDialog::OnDestroy();
  246. }
  247. void ShowCut::LoadPhotos()
  248. {
  249. if (m_bRunning)return;
  250. m_patharray1.RemoveAll();
  251. m_path.MakeLower();
  252. CStringArray dirarray;
  253. CString str, path2, no;
  254. if (1)
  255. {
  256. using namespace helper_coffs;
  257. ffsco o;
  258. o.dirs(1);
  259. o.find(LPCSTR(m_path), LPCSTR("*.*"));
  260. ffsco::typeT coo;
  261. ffsco::typeT::iterator it;
  262. coo = o.co_dir();
  263. for (it = coo.begin();coo.end() != it;it++)
  264. {
  265. str = (*it).c_str();
  266. str.MakeLower();
  267. if (str == m_path)continue;
  268. if (FindArray(&dirarray, str) == -1)
  269. {
  270. dirarray.Add(str);
  271. }
  272. }
  273. }
  274. if (1)
  275. {
  276. for (int i = 0; i < dirarray.GetSize(); i++)
  277. {
  278. using namespace helper_coffs;
  279. ffsco o;
  280. o.dirs(1);
  281. o.find(LPCSTR(dirarray.ElementAt(i)), LPCSTR("*.jpg"));
  282. ffsco::typeT coo;
  283. ffsco::typeT::iterator it;
  284. coo = o.co_file();
  285. for (it = coo.begin();coo.end() != it;it++)
  286. {
  287. str = (*it).c_str();
  288. if (str.GetAt(str.ReverseFind('\\') + 1) == 's')continue;
  289. if (str.GetAt(str.ReverseFind('\\') + 1) == 'm')continue;
  290. str.MakeLower();
  291. path2 = str;
  292. path2.Replace("客户原片", "修好的片");
  293. int pos1 = path2.Find(m_id);
  294. pos1 += m_id.GetLength();
  295. int pos2 = path2.ReverseFind('\\');
  296. path2 = path2.Left(pos1) + path2.Right(path2.GetLength() - pos2);
  297. no = str.Right(str.GetLength() - str.ReverseFind('\\') - 1);
  298. no = no.Left(no.Find("."));
  299. CStringArray noarray, namearray;
  300. noarray.Copy(m_noarray);
  301. namearray.Copy(m_namearray);
  302. int pos = ::FindArray(&noarray, no);
  303. while (pos != -1)
  304. {
  305. if (::PathFileExists(path2))
  306. {
  307. m_patharray1.Add(path2);
  308. }
  309. else
  310. {
  311. m_patharray1.Add(str);
  312. }
  313. m_titlearray.Add(no + "\r\n" + namearray.ElementAt(pos));
  314. noarray.RemoveAt(pos); namearray.RemoveAt(pos);
  315. pos = ::FindArray(&noarray, no);
  316. }
  317. }
  318. }
  319. }
  320. if (m_patharray1.GetSize() == 0 && m_mode)
  321. {
  322. if (m_mode == 2)
  323. AfxMessageBox("无照片裁剪!");
  324. CDialog::OnCancel();
  325. return;
  326. }
  327. CStringArray *pArray = &m_patharray1;
  328. m_vFileName.clear();
  329. for (int i = 0; i < pArray->GetSize(); i++)
  330. {
  331. CString filePath = pArray->ElementAt(i);
  332. filePath.MakeLower();
  333. m_vFileName.push_back(filePath);
  334. }
  335. LoadThumbImages();
  336. }
  337. void ShowCut::OnBUTdelall()
  338. {
  339. if (AfxMessageBox("清除裁剪后将无法恢复, 确认清除吗?", MB_YESNO | MB_ICONSTOP) != IDYES)
  340. return;
  341. CString sql;
  342. sql.Format("update dindan set size='' where id='%s'", m_id);
  343. g_sendhead.bsql = 1;
  344. if (m_branch != "" && g_bAllBranch)
  345. {
  346. g_branchip = GetIP(m_branch);
  347. g_pMainWnd->OnDisconnect();
  348. g_branchname = m_branch;
  349. g_bBranchModify = 1;
  350. g_pMainWnd->ProcessChatMessageRequest2(sql);
  351. g_pMainWnd->OnDisconnect();
  352. g_bBranchModify = 0;
  353. g_branchip = g_branchname = "";
  354. }
  355. else
  356. g_pMainWnd->ProcessChatMessageRequest2(sql);
  357. if (g_bSendOK == 0)return;
  358. AfxMessageBox("保存成功!");
  359. GetSize();
  360. LoadPhotos();
  361. }
  362. void ShowCut::OnBUTdel()
  363. {
  364. POSITION pos;
  365. pos = m_List1.GetFirstSelectedItemPosition();
  366. if (pos == NULL)
  367. {
  368. AfxMessageBox("请先选中您要清除裁剪的照片!", MB_ICONINFORMATION);
  369. return;
  370. }
  371. if (AfxMessageBox("清除裁剪后将无法恢复, 确认清除吗?", MB_YESNO | MB_ICONSTOP) != IDYES)return;
  372. int iItem = m_List1.GetNextSelectedItem(pos);
  373. CString title = m_List1.GetItemText(iItem, 0);
  374. CString no = title.Left(title.Find("\r"));
  375. CString name = title.Right(title.GetLength() - title.ReverseFind('\n') - 1);
  376. {
  377. CString header = no + ":" + name + ",";
  378. int pos = m_size.Find(header);
  379. if (pos != -1)
  380. {
  381. CString left, right;
  382. left = m_size.Left(pos);
  383. m_size = m_size.Right(m_size.GetLength() - pos - header.GetLength());
  384. pos = m_size.Find(";");
  385. right = m_size.Right(m_size.GetLength() - pos - 1);
  386. m_size = left + right;
  387. }
  388. }
  389. CString sql;
  390. sql.Format("update dindan set size='%s' where id='%s'", m_size, m_id);
  391. g_sendhead.bsql = 1;
  392. if (m_branch != "" && g_bAllBranch)
  393. {
  394. g_branchip = GetIP(m_branch);
  395. g_pMainWnd->OnDisconnect();
  396. g_branchname = m_branch;
  397. g_bBranchModify = 1;
  398. g_pMainWnd->ProcessChatMessageRequest2(sql);
  399. g_pMainWnd->OnDisconnect();
  400. g_bBranchModify = 0;
  401. g_branchip = g_branchname = "";
  402. }
  403. else
  404. g_pMainWnd->ProcessChatMessageRequest2(sql);
  405. if (g_bSendOK == 0)return;
  406. AfxMessageBox("保存成功!");
  407. GetSize();
  408. LoadPhotos();
  409. }
  410. void ShowCut::AddSize(CString size)
  411. {
  412. int pos = size.Find(":");
  413. if (pos != -1)
  414. {
  415. CString str;
  416. CRect rc;
  417. str = size.Left(pos);
  418. m_noarray.Add(str);
  419. str = size.Right(size.GetLength() - pos - 1);
  420. pos = str.Find(",");
  421. m_namearray.Add(str.Left(pos)); str.Delete(0, pos + 1);
  422. pos = str.Find(",");
  423. rc.left = atoi(str.Left(pos)); str.Delete(0, pos + 1);
  424. pos = str.Find(",");
  425. rc.top = atoi(str.Left(pos)); str.Delete(0, pos + 1);
  426. m_widtharray.Add(rc);
  427. pos = str.Find(",");
  428. rc.left = atoi(str.Left(pos)); str.Delete(0, pos + 1);
  429. pos = str.Find(",");
  430. rc.top = atoi(str.Left(pos)); str.Delete(0, pos + 1);
  431. pos = str.Find(",");
  432. rc.right = atoi(str.Left(pos)); str.Delete(0, pos + 1);
  433. rc.bottom = atoi(str);
  434. m_rcarray.Add(rc);
  435. }
  436. }
  437. BOOL ShowCut::GetSize()
  438. {
  439. g_sendhead.bsql = 0;
  440. g_sendhead.code[0] = 11;
  441. g_sendhead.tabcount = 1;
  442. CString filter = "id='" + m_id + "';";
  443. if (m_branch != "")
  444. {
  445. g_branchip = GetIP(m_branch);
  446. g_pMainWnd->OnDisconnect();
  447. g_branchname = m_branch;
  448. g_bBranchModify = 1;
  449. g_pMainWnd->ProcessChatMessageRequest2(filter);
  450. g_pMainWnd->OnDisconnect();
  451. g_bBranchModify = 0;
  452. g_branchip = g_branchname = "";
  453. }
  454. else
  455. g_pMainWnd->ProcessChatMessageRequest2(filter);
  456. if (g_bSendOK == 0)
  457. {
  458. return 0;
  459. }
  460. CArray<CStringArray, CStringArray>m_List1array;
  461. DataToArray(&m_List1array);
  462. CenterWindow();
  463. m_noarray.RemoveAll();
  464. m_widtharray.RemoveAll();
  465. m_rcarray.RemoveAll();
  466. if (m_List1array.GetSize())
  467. {
  468. m_size = m_List1array.ElementAt(0).ElementAt(60);//
  469. int pos = m_size.Find(";");
  470. while (pos != -1)
  471. {
  472. AddSize(m_size.Left(pos));
  473. m_size = m_size.Right(m_size.GetLength() - pos - 1);
  474. pos = m_size.Find(";");
  475. }
  476. m_size = m_List1array.ElementAt(0).ElementAt(60); return 1;
  477. }
  478. return 0;
  479. }
  480. int ShowCut::FindArray2(CString title)
  481. {
  482. CString no = title.Left(title.Find("\r"));
  483. CString name = title.Right(title.GetLength() - title.ReverseFind('\n') - 1);
  484. for (int i = 0; i < m_noarray.GetSize(); i++)
  485. {
  486. if (no == m_noarray.ElementAt(i) && name == m_namearray.ElementAt(i))
  487. return i;
  488. }
  489. return -1;
  490. }
  491. void ShowCut::OnDblclkList1(NMHDR* pNMHDR, LRESULT* pResult) // 双击裁剪小图查看大图效果;
  492. {
  493. POSITION pos;
  494. pos = m_List1.GetFirstSelectedItemPosition();
  495. if (pos == NULL)
  496. {
  497. return;
  498. }
  499. int iItem = m_List1.GetNextSelectedItem(pos);
  500. Image *image = NULL;
  501. if (m_patharray1.GetSize() <= iItem)return;
  502. CString str = m_patharray1.ElementAt(iItem);
  503. ::LoadImageFromBuf(&image, str);
  504. int orientation = GetOrientation(image);
  505. if (orientation == 8)
  506. image->RotateFlip(Rotate270FlipNone);
  507. else if (orientation == 6)
  508. image->RotateFlip(Rotate90FlipNone);
  509. if (image->GetWidth() == 0)
  510. return;
  511. Graphics graph(image);
  512. // Rect desRect(XDest, YDest, nDestWidth, nDestHeight);
  513. // Draw Image
  514. // graph.DrawImage(image, desRect, 0,0,image->GetWidth(),image->GetHeight(),UnitPixel);
  515. float scale = 1.0;//(float)nDestWidth/(float)image->GetWidth();
  516. int pos2 = FindArray2(m_titlearray.ElementAt(iItem));
  517. if (pos2 != -1)
  518. {
  519. int nIndex = pos2;
  520. CRect rc = m_rcarray.ElementAt(nIndex);
  521. int wid = m_widtharray.ElementAt(nIndex).left;
  522. int hei = m_widtharray.ElementAt(nIndex).top;
  523. scale *= (float)image->GetWidth() / (float)wid;
  524. rc.left *= scale;
  525. rc.right *= scale;
  526. rc.top *= scale;
  527. rc.bottom *= scale;
  528. /* rc.left +=XDest ;
  529. rc.right +=XDest;
  530. rc.top +=YDest ;
  531. rc.bottom +=YDest ;*/
  532. Pen blackPen(Color(255, 255, 0, 0), 1);
  533. graph.DrawRectangle(&blackPen, rc.left, rc.top, rc.Width(), rc.Height());
  534. ShowPhoto dlg;
  535. dlg.m_pImg = image;
  536. dlg.DoModal();
  537. }
  538. delete image;
  539. *pResult = 0;
  540. }