ShowCut.cpp 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638
  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)return;
  340. CString sql;
  341. sql.Format("update dindan set size='' where id='%s'", m_id);
  342. g_sendhead.bsql = 1;
  343. if (m_branch != "" && g_bAllBranch)
  344. {
  345. g_branchip = GetIP(m_branch);
  346. g_pMainWnd->OnDisconnect();
  347. g_branchname = m_branch;
  348. g_bBranchModify = 1;
  349. g_pMainWnd->ProcessChatMessageRequest2(sql);
  350. g_pMainWnd->OnDisconnect(); g_bBranchModify = 0;
  351. g_branchip = g_branchname = "";
  352. }
  353. else
  354. g_pMainWnd->ProcessChatMessageRequest2(sql);
  355. if (g_bSendOK == 0)return;
  356. AfxMessageBox("保存成功!");
  357. GetSize();
  358. LoadPhotos();
  359. }
  360. void ShowCut::OnBUTdel()
  361. {
  362. POSITION pos;
  363. pos = m_List1.GetFirstSelectedItemPosition();
  364. if (pos == NULL)
  365. {
  366. AfxMessageBox("请先选中您要清除裁剪的照片!", MB_ICONINFORMATION);
  367. return;
  368. }
  369. if (AfxMessageBox("清除裁剪后将无法恢复, 确认清除吗?", MB_YESNO | MB_ICONSTOP) != IDYES)return;
  370. int iItem = m_List1.GetNextSelectedItem(pos);
  371. CString title = m_List1.GetItemText(iItem, 0);
  372. CString no = title.Left(title.Find("\r"));
  373. CString name = title.Right(title.GetLength() - title.ReverseFind('\n') - 1);
  374. {
  375. CString header = no + ":" + name + ",";
  376. int pos = m_size.Find(header);
  377. if (pos != -1)
  378. {
  379. CString left, right;
  380. left = m_size.Left(pos);
  381. m_size = m_size.Right(m_size.GetLength() - pos - header.GetLength());
  382. pos = m_size.Find(";");
  383. right = m_size.Right(m_size.GetLength() - pos - 1);
  384. m_size = left + right;
  385. }
  386. }
  387. CString sql;
  388. sql.Format("update dindan set size='%s' where id='%s'", m_size, m_id);
  389. g_sendhead.bsql = 1;
  390. if (m_branch != "" && g_bAllBranch)
  391. {
  392. g_branchip = GetIP(m_branch);
  393. g_pMainWnd->OnDisconnect();
  394. g_branchname = m_branch;
  395. g_bBranchModify = 1;
  396. g_pMainWnd->ProcessChatMessageRequest2(sql);
  397. g_pMainWnd->OnDisconnect();
  398. g_bBranchModify = 0;
  399. g_branchip = g_branchname = "";
  400. }
  401. else
  402. g_pMainWnd->ProcessChatMessageRequest2(sql);
  403. if (g_bSendOK == 0)return;
  404. AfxMessageBox("保存成功!");
  405. GetSize();
  406. LoadPhotos();
  407. }
  408. void ShowCut::AddSize(CString size)
  409. {
  410. int pos = size.Find(":");
  411. if (pos != -1)
  412. {
  413. CString str;
  414. CRect rc;
  415. str = size.Left(pos);
  416. m_noarray.Add(str);
  417. str = size.Right(size.GetLength() - pos - 1);
  418. pos = str.Find(",");
  419. m_namearray.Add(str.Left(pos)); str.Delete(0, pos + 1);
  420. pos = str.Find(",");
  421. rc.left = atoi(str.Left(pos)); str.Delete(0, pos + 1);
  422. pos = str.Find(",");
  423. rc.top = atoi(str.Left(pos)); str.Delete(0, pos + 1);
  424. m_widtharray.Add(rc);
  425. pos = str.Find(",");
  426. rc.left = atoi(str.Left(pos)); str.Delete(0, pos + 1);
  427. pos = str.Find(",");
  428. rc.top = atoi(str.Left(pos)); str.Delete(0, pos + 1);
  429. pos = str.Find(",");
  430. rc.right = atoi(str.Left(pos)); str.Delete(0, pos + 1);
  431. rc.bottom = atoi(str);
  432. m_rcarray.Add(rc);
  433. }
  434. }
  435. BOOL ShowCut::GetSize()
  436. {
  437. g_sendhead.bsql = 0;
  438. g_sendhead.code[0] = 11;
  439. g_sendhead.tabcount = 1;
  440. CString filter = "id='" + m_id + "';";
  441. if (m_branch != "")
  442. {
  443. g_branchip = GetIP(m_branch);
  444. g_pMainWnd->OnDisconnect();
  445. g_branchname = m_branch;
  446. g_bBranchModify = 1;
  447. g_pMainWnd->ProcessChatMessageRequest2(filter);
  448. g_pMainWnd->OnDisconnect();
  449. g_bBranchModify = 0;
  450. g_branchip = g_branchname = "";
  451. }
  452. else
  453. g_pMainWnd->ProcessChatMessageRequest2(filter);
  454. if (g_bSendOK == 0)
  455. {
  456. return 0;
  457. }
  458. CArray<CStringArray, CStringArray>m_List1array;
  459. DataToArray(&m_List1array);
  460. CenterWindow();
  461. m_noarray.RemoveAll();
  462. m_widtharray.RemoveAll();
  463. m_rcarray.RemoveAll();
  464. if (m_List1array.GetSize())
  465. {
  466. m_size = m_List1array.ElementAt(0).ElementAt(60);//
  467. int pos = m_size.Find(";");
  468. while (pos != -1)
  469. {
  470. AddSize(m_size.Left(pos));
  471. m_size = m_size.Right(m_size.GetLength() - pos - 1);
  472. pos = m_size.Find(";");
  473. }
  474. m_size = m_List1array.ElementAt(0).ElementAt(60); return 1;
  475. }
  476. return 0;
  477. }
  478. int ShowCut::FindArray2(CString title)
  479. {
  480. CString no = title.Left(title.Find("\r"));
  481. CString name = title.Right(title.GetLength() - title.ReverseFind('\n') - 1);
  482. for (int i = 0; i < m_noarray.GetSize(); i++)
  483. {
  484. if (no == m_noarray.ElementAt(i) && name == m_namearray.ElementAt(i))
  485. return i;
  486. }
  487. return -1;
  488. }
  489. void ShowCut::OnDblclkList1(NMHDR* pNMHDR, LRESULT* pResult) // 双击裁剪小图查看大图效果;
  490. {
  491. POSITION pos;
  492. pos = m_List1.GetFirstSelectedItemPosition();
  493. if (pos == NULL)
  494. {
  495. return;
  496. }
  497. int iItem = m_List1.GetNextSelectedItem(pos);
  498. Image *image = NULL;
  499. if (m_patharray1.GetSize() <= iItem)return;
  500. CString str = m_patharray1.ElementAt(iItem);
  501. ::LoadImageFromBuf(&image, str);
  502. int orientation = GetOrientation(image);
  503. if (orientation == 8)
  504. image->RotateFlip(Rotate270FlipNone);
  505. else if (orientation == 6)
  506. image->RotateFlip(Rotate90FlipNone);
  507. if (image->GetWidth() == 0)
  508. return;
  509. Graphics graph(image);
  510. // Rect desRect(XDest, YDest, nDestWidth, nDestHeight);
  511. // Draw Image
  512. // graph.DrawImage(image, desRect, 0,0,image->GetWidth(),image->GetHeight(),UnitPixel);
  513. float scale = 1.0;//(float)nDestWidth/(float)image->GetWidth();
  514. int pos2 = FindArray2(m_titlearray.ElementAt(iItem));
  515. if (pos2 != -1)
  516. {
  517. int nIndex = pos2;
  518. CRect rc = m_rcarray.ElementAt(nIndex);
  519. int wid = m_widtharray.ElementAt(nIndex).left;
  520. int hei = m_widtharray.ElementAt(nIndex).top;
  521. scale *= (float)image->GetWidth() / (float)wid;
  522. rc.left *= scale;
  523. rc.right *= scale;
  524. rc.top *= scale;
  525. rc.bottom *= scale;
  526. /* rc.left +=XDest ;
  527. rc.right +=XDest;
  528. rc.top +=YDest ;
  529. rc.bottom +=YDest ;*/
  530. Pen blackPen(Color(255, 255, 0, 0), 1);
  531. graph.DrawRectangle(&blackPen, rc.left, rc.top, rc.Width(), rc.Height());
  532. ShowPhoto dlg;
  533. dlg.m_pImg = image;
  534. dlg.DoModal();
  535. }
  536. delete image;
  537. *pResult = 0;
  538. }