ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/proj/trunk/VTBFileUtil2/ScanUtility.cxx
(Generate patch)

Comparing trunk/VTBFileUtil2/ScanUtility.cxx (file contents):
Revision 273 by douglas, 2003-08-20T23:29:24-07:00 vs.
Revision 281 by douglas, 2003-08-25T14:56:30-07:00

# Line 2 | Line 2
2   //
3   // Douglas Thrift
4   //
5 < // $Id: ScanUtility.cxx,v 1.6 2003/08/21 06:29:24 douglas Exp $
5 > // $Id: ScanUtility.cxx,v 1.10 2003/08/25 21:56:30 douglas Exp $
6  
7   #include "ScanUtility.h"
8  
# Line 14 | Line 14 | ScanUtility::ScanUtility()
14  
15          sprintf(title, "%s - Scan Utility", programName.c_str());
16          loadDirs();
17 +
18 +        popup = CreatePopupMenu();
19 +
20 +        MENUITEMINFO open, separator, properties;
21 +
22 +        open.cbSize = sizeof(open);
23 +        open.fMask = MIIM_ID | MIIM_STATE | MIIM_TYPE;
24 +        open.fType = MFT_STRING;
25 +        open.fState = MFS_DEFAULT;
26 +        open.wID = 1;
27 +        open.dwTypeData = "&Open";
28 +        open.cch = 5;
29 +        separator.cbSize = sizeof(open);
30 +        separator.fMask = MIIM_TYPE;
31 +        separator.fType = MFT_SEPARATOR;
32 +        properties.cbSize = sizeof(open);
33 +        properties.fMask = MIIM_ID | MIIM_TYPE;
34 +        properties.fType = MFT_STRING;
35 +        properties.wID = 2;
36 +        properties.dwTypeData = "P&roperties";
37 +        properties.cch = 11;
38 +
39 +        InsertMenuItem(popup, 0, TRUE, &open);
40 +        InsertMenuItem(popup, 1, TRUE, &separator);
41 +        InsertMenuItem(popup, 2, TRUE, &properties);
42          
43          // start
44          wizard[0].dwSize = sizeof(wizard[0]);
# Line 40 | Line 65 | ScanUtility::ScanUtility()
65          wizard[1].lParam = number;
66          wizard[1].pszHeaderTitle = "Select";
67          wizard[1].pszHeaderSubTitle = "Choose the scanned document to save.";
68 +
69 +        // enter
70 +        wizard[2].dwSize = sizeof(wizard[2]);
71 +        wizard[2].dwFlags = PSP_DEFAULT | PSP_USEHICON | PSP_USETITLE |
72 +                PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
73 +        wizard[2].hInstance = gui.instance;
74 +        wizard[2].pszTemplate = MAKEINTRESOURCE(IDD_ENTER);
75 +        wizard[2].hIcon = gui.icon;
76 +        wizard[2].pszTitle = title;
77 +        wizard[2].pfnDlgProc = enter;
78 +        wizard[2].lParam = number;
79 +        wizard[2].pszHeaderTitle = "Enter";
80 +        wizard[2].pszHeaderSubTitle = "Input the client information.";
81 +
82 +        // confirm
83 +        wizard[3].dwSize = sizeof(wizard[3]);
84 +        wizard[3].dwFlags = PSP_DEFAULT | PSP_USEHICON | PSP_USETITLE |
85 +                PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
86 +        wizard[3].hInstance = gui.instance;
87 +        wizard[3].pszTemplate = MAKEINTRESOURCE(IDD_CONFIRM);
88 +        wizard[3].hIcon = gui.icon;
89 +        wizard[3].pszTitle = title;
90 +        wizard[3].pfnDlgProc = confirm;
91 +        wizard[3].lParam = number;
92 +        wizard[3].pszHeaderTitle = "Confirm";
93 +        wizard[3].pszHeaderSubTitle = "Make sure the file information is correct.";
94 +
95 +        // complete
96 +        wizard[4].dwSize = sizeof(wizard[3]);
97 +        wizard[4].dwFlags = PSP_DEFAULT | PSP_USEHICON | PSP_USETITLE |
98 +                PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
99 +        wizard[4].hInstance = gui.instance;
100 +        wizard[4].pszTemplate = MAKEINTRESOURCE(IDD_DONE);
101 +        wizard[4].hIcon = gui.icon;
102 +        wizard[4].pszTitle = title;
103 +        wizard[4].pfnDlgProc = done;
104 +        wizard[4].lParam = number;
105 +        wizard[4].pszHeaderTitle = "Done";
106 +        wizard[4].pszHeaderSubTitle = "Exit or start over for another scan.";
107   }
108  
109   ScanUtility::~ScanUtility()
110   {
111 +        DestroyMenu(popup);
112          utilities.erase(number);
113          saveDirs();
114  
# Line 57 | Line 122 | void ScanUtility::run(void)
122          // header
123          header.dwSize = sizeof(header);
124          header.dwFlags = PSH_DEFAULT | PSH_HEADER | PSH_PROPSHEETPAGE |
125 <                PSH_USEICONID | PSH_WIZARD97;
125 >                PSH_USEICONID | PSH_WIZARD97 | PSH_WIZARDHASFINISH;
126          header.hwndParent = NULL;
127          header.hInstance = gui.instance;
128          header.pszIcon = MAKEINTRESOURCE(IDI_VTB_ICON);
129 <        header.nPages = 2;
129 >        header.nPages = 5;
130          header.nStartPage = 0;
131          header.ppsp = wizard;
132          header.pszbmHeader = MAKEINTRESOURCE(IDB_VTB_BMP);
# Line 378 | Line 443 | void ScanUtility::populate(HWND parent)
443                  ListView_SetImageList(GetDlgItem(parent, IDC_SELECT_SCANS), icons,
444                          LVSIL_SMALL);
445  
381                int index = 0;
382
446                  if (debug) cerr << "scans = {\n";
447  
448                  for (set<string>::iterator itor = scans.begin(); itor != scans.end();
# Line 394 | Line 457 | void ScanUtility::populate(HWND parent)
457                          LVITEM item;
458  
459                          item.mask = LVIF_IMAGE | LVIF_TEXT;
460 <                        item.iItem = index++;
460 >                        item.iItem = 0;
461                          item.iSubItem = 0;
399                        item.state = LVIS_SELECTED;
400                        item.stateMask = LVIS_SELECTED;
462                          item.pszText = scan;
463                          item.iImage = info.iIcon;
464  
# Line 405 | Line 466 | void ScanUtility::populate(HWND parent)
466                  }
467  
468                  if (debug) cerr << "}\n";
469 +
470 +                ListView_SetItemState(GetDlgItem(parent, IDC_SELECT_SCANS), 0,
471 +                        LVIS_SELECTED, LVIS_SELECTED);
472          }
473   }
474  
475 + ScanUtility* ScanUtility::which(HWND window)
476 + {
477 +        map<HWND, ScanUtility*>::iterator itor = windows.find(window);
478 +
479 +        return itor->second;
480 + }
481 +
482 + ScanUtility* ScanUtility::which(HWND window, LPARAM l)
483 + {
484 +        LPPROPSHEETPAGE page = LPPROPSHEETPAGE(l);
485 +        map<unsigned, ScanUtility*>::iterator itor = utilities.find(page->lParam);
486 +
487 +        windows.insert(pair<HWND, ScanUtility*>(window, itor->second));
488 +
489 +        return itor->second;
490 + }
491 +
492   int ScanUtility::browse(HWND dialog, UINT msg, LPARAM l, LPARAM d)
493   {
494          map<unsigned, ScanUtility*>::iterator itor = utilities.find(LOWORD(d));
# Line 453 | Line 534 | int ScanUtility::browse(HWND dialog, UIN
534  
535   INT_PTR ScanUtility::start(HWND dialog, UINT msg, WPARAM w, LPARAM l)
536   {
537 <        map<HWND, ScanUtility*>::iterator itor = windows.find(dialog);
457 <        ScanUtility* data = itor->second;
537 >        ScanUtility* data = which(dialog);
538  
539          switch (msg)
540          {
541          case WM_INITDIALOG:
542                  center(GetParent(dialog));
543 <                {
544 <                        LPPROPSHEETPAGE page = LPPROPSHEETPAGE(l);
545 <                        map<unsigned, ScanUtility*>::iterator itor =
466 <                                utilities.find(page->lParam);
543 >                SendMessage(GetParent(dialog), WM_SETICON, ICON_BIG, LPARAM(gui.icon));
544 >                
545 >                data = which(dialog, l);
546  
468                        windows.insert(pair<HWND, ScanUtility*>(dialog, itor->second));
469                }
547                  {
548                          ostringstream instructions;
549  
550 <                        instructions << "1.\tIf you need instructions, you should not be r"
551 <                                << "unning this program\n\tin Scan Utility mode.\n"
552 <                                << "2.\tOtherwise, go forth and scan.\n"
553 <                                << "3.\tThen come back and click Next.\n";
550 >                        instructions << "1. If you need instructions, you should not be ru"
551 >                                << "nning this program in Scan Utility mode.\n"
552 >                                << "2. Otherwise, go forth and scan.\n"
553 >                                << "3. Then come back and click Next.\n";
554  
555                          SetDlgItemText(dialog, IDC_START_INSTRUCTIONS,
556                                  instructions.str().c_str());
# Line 486 | Line 563 | INT_PTR ScanUtility::start(HWND dialog,
563                          switch (nm->code)
564                          {
565                          case PSN_SETACTIVE:
566 <                                PropSheet_SetWizButtons(GetParent(dialog), PSWIZB_NEXT);
566 >                                PropSheet_SetWizButtons(GetParent(dialog), PSWIZB_FINISH |
567 >                                        PSWIZB_NEXT);
568 >
569                                  {
570                                          char folder[44];
571  
# Line 532 | Line 611 | INT_PTR ScanUtility::start(HWND dialog,
611  
612   INT_PTR ScanUtility::select(HWND dialog, UINT msg, WPARAM w, LPARAM l)
613   {
614 <        map<HWND, ScanUtility*>::iterator itor = windows.find(dialog);
536 <        ScanUtility* data = itor->second;
614 >        ScanUtility* data = which(dialog);
615  
616          switch (msg)
617          {
618          case WM_INITDIALOG:
619 +                data = which(dialog, l);
620 +
621                  {
622 <                        LPPROPSHEETPAGE page = LPPROPSHEETPAGE(l);
623 <                        map<unsigned, ScanUtility*>::iterator itor =
624 <                                utilities.find(page->lParam);
622 >                        ostringstream select;
623 >
624 >                        select << "Select the scanned document that you need to be save.";
625  
626 <                        windows.insert(pair<HWND, ScanUtility*>(dialog, itor->second));
626 >                        SetDlgItemText(dialog, IDC_SELECT_TEXT, select.str().c_str());
627                  }
628 +
629                  {
630                          LVCOLUMN column;
631  
# Line 560 | Line 641 | INT_PTR ScanUtility::select(HWND dialog,
641          case WM_NOTIFY:
642                  if (w == IDC_SELECT_SCANS)
643                  {
644 <                        switch (ListView_GetSelectedCount(GetDlgItem(dialog,
645 <                                IDC_SELECT_SCANS)))
644 >                        LPNMITEMACTIVATE ni = LPNMITEMACTIVATE(l);
645 >
646 >                        switch (ni->hdr.code)
647                          {
648 <                        case 1:
649 <                                PropSheet_SetWizButtons(GetParent(dialog), PSWIZB_BACK |
650 <                                        PSWIZB_NEXT);
651 <                                break;
652 <                        default:
653 <                                PropSheet_SetWizButtons(GetParent(dialog), PSWIZB_BACK);
648 >                        case NM_DBLCLK:
649 >                                {
650 >                                        char scan[MAX_PATH];
651 >
652 >                                        ListView_GetItemText(GetDlgItem(dialog, IDC_SELECT_SCANS),
653 >                                                ni->iItem, 0, scan, MAX_PATH);
654 >                                        ShellExecute(dialog, NULL, scan, NULL, NULL,
655 >                                                SW_SHOWDEFAULT);
656 >                                }
657                                  break;
658                          }
659                  }
# Line 579 | Line 664 | INT_PTR ScanUtility::select(HWND dialog,
664                          switch (nm->code)
665                          {
666                          case PSN_SETACTIVE:
667 <                                PropSheet_SetWizButtons(GetParent(dialog), PSWIZB_BACK);
667 >                                PropSheet_SetWizButtons(GetParent(dialog), PSWIZB_BACK |
668 >                                        PSWIZB_DISABLEDFINISH | PSWIZB_NEXT);
669                                  data->populate(dialog);
670                                  break;
671                          case PSN_WIZBACK:
672                                  ListView_DeleteAllItems(GetDlgItem(dialog, IDC_SELECT_SCANS));
673 +                                data->client.setFile("");
674                                  break;
675                          case PSN_WIZNEXT:
676 <                                //
676 >                                {
677 >                                        int index = ListView_GetNextItem(GetDlgItem(dialog,
678 >                                                IDC_SELECT_SCANS), -1, LVNI_SELECTED);
679 >                                        char scan[MAX_PATH];
680 >
681 >                                        ListView_GetItemText(GetDlgItem(dialog, IDC_SELECT_SCANS),
682 >                                                index, 0, scan, MAX_PATH);
683 >
684 >                                        data->scan = scan;
685 >                                }
686 >
687                                  ListView_DeleteAllItems(GetDlgItem(dialog, IDC_SELECT_SCANS));
688 +
689 +                                if (debug) cerr << "scan = " << data->scan << "\n";
690 +                                break;
691 +                        }
692 +                }
693 +                break;
694 +        case WM_CONTEXTMENU:
695 +                {
696 +                        char scan[MAX_PATH];
697 +                        POINT spot;
698 +                        LVHITTESTINFO test;
699 +
700 +                        test.pt.x = GET_X_LPARAM(l);
701 +                        test.pt.y = GET_Y_LPARAM(l);
702 +
703 +                        ScreenToClient(GetDlgItem(dialog, IDC_SELECT_SCANS), &test.pt);
704 +                        ListView_HitTest(GetDlgItem(dialog, IDC_SELECT_SCANS), &test);
705 +
706 +                        if (test.iItem != -1)
707 +                        {
708 +                                ListView_GetItemText(GetDlgItem(dialog, IDC_SELECT_SCANS),
709 +                                        test.iItem, 0, scan, MAX_PATH);
710 +                                
711 +                                spot.x = test.pt.x;
712 +                                spot.y = test.pt.y;
713 +                        }
714 +                        else if (GET_X_LPARAM(l) == -1 && GET_Y_LPARAM(l) == -1)
715 +                        {
716 +                                int index = ListView_GetNextItem(GetDlgItem(dialog,
717 +                                        IDC_SELECT_SCANS), -1, LVNI_SELECTED);
718 +                                RECT rect;
719 +
720 +                                ListView_GetItemText(GetDlgItem(dialog, IDC_SELECT_SCANS),
721 +                                        index, 0, scan, MAX_PATH);
722 +                                ListView_EnsureVisible(GetDlgItem(dialog, IDC_SELECT_SCANS),
723 +                                        index, FALSE);
724 +                                ListView_GetItemRect(GetDlgItem(dialog, IDC_SELECT_SCANS),
725 +                                        index, &rect, LVIR_SELECTBOUNDS);
726 +
727 +                                spot.x = rect.left;
728 +                                spot.y = rect.top;
729 +                        }
730 +                        else
731 +                        {
732 +                                break;
733 +                        }
734 +
735 +                        ClientToScreen(GetDlgItem(dialog, IDC_SELECT_SCANS), &spot);
736 +
737 +                        int code = TrackPopupMenuEx(data->popup, TPM_LEFTALIGN |
738 +                                TPM_TOPALIGN | TPM_NONOTIFY | TPM_RETURNCMD | TPM_RIGHTBUTTON,
739 +                                spot.x, spot.y, GetDlgItem(dialog, IDC_SELECT_SCANS), NULL);
740 +
741 +                        switch (code)
742 +                        {
743 +                        case 1:
744 +                                ShellExecute(dialog, NULL, scan, NULL, NULL, SW_SHOWDEFAULT);
745 +                                break;
746 +                        case 2:
747 +                                {
748 +                                        SHELLEXECUTEINFO info;
749 +
750 +                                        info.cbSize = sizeof(info);
751 +                                        info.fMask = SEE_MASK_INVOKEIDLIST;
752 +                                        info.hwnd = dialog;
753 +                                        info.lpVerb = "properties";
754 +                                        info.lpFile = scan;
755 +                                        info.lpParameters = NULL;
756 +                                        info.lpDirectory = NULL;
757 +                                        info.nShow = SW_SHOWDEFAULT;
758 +                                        info.lpIDList = NULL;
759 +
760 +                                        ShellExecuteEx(&info);
761 +                                }
762 +                                break;
763 +                        }
764 +                }
765 +                break;
766 +        }
767 +
768 +        return FALSE;
769 + }
770 +
771 + INT_PTR ScanUtility::enter(HWND dialog, UINT msg, WPARAM w, LPARAM l)
772 + {
773 +        ScanUtility* data = which(dialog);
774 +
775 +        switch (msg)
776 +        {
777 +        case WM_INITDIALOG:
778 +                data = which(dialog, l);
779 +
780 +                {
781 +                        ostringstream enter;
782 +
783 +                        enter << "Enter the client name and number.";
784 +
785 +                        SetDlgItemText(dialog, IDC_ENTER_TEXT, enter.str().c_str());
786 +                }
787 +                break;
788 +        case WM_NOTIFY:
789 +                {
790 +                        LPNMHDR nm = LPNMHDR(l);
791 +
792 +                        switch (nm->code)
793 +                        {
794 +                        case PSN_SETACTIVE:
795 +                                if (data->client.getName() != "" && data->client.getNumber() !=
796 +                                        0)
797 +                                {
798 +                                        PropSheet_SetWizButtons(GetParent(dialog), PSWIZB_BACK |
799 +                                                PSWIZB_DISABLEDFINISH | PSWIZB_NEXT);
800 +                                }
801 +                                else
802 +                                {
803 +                                        PropSheet_SetWizButtons(GetParent(dialog), PSWIZB_BACK |
804 +                                                PSWIZB_DISABLEDFINISH);
805 +                                }
806 +
807 +                                SetDlgItemText(dialog, IDC_ENTER_NAME,
808 +                                        data->client.getName().c_str());
809 +
810 +                                if (data->client.getNumber() != 0)
811 +                                {
812 +                                        SetDlgItemInt(dialog, IDC_ENTER_NUM,
813 +                                                data->client.getNumber(), FALSE);
814 +                                }
815 +                                else
816 +                                {
817 +                                        SetDlgItemText(dialog, IDC_ENTER_NUM, "");
818 +                                }
819 +                                break;
820 +                        case PSN_WIZBACK:
821 +                                break;
822 +                        case PSN_WIZNEXT:
823 +                                if (debug)
824 +                                {
825 +                                        cerr << "client = {\n"
826 +                                                << "   name = " << data->client.getName() << "\n"
827 +                                                << "   number = " << data->client.getNumber() << "\n"
828 +                                                << "   file = " << data->client.getFile() << "\n"
829 +                                                << "}\n";
830 +                                }
831 +
832 +                                data->save = data->saveDir + '\\' + data->client.getFile();
833 +
834 +                                if (debug) cerr << "save = " << data->save << "\n";
835 +                                
836                                  break;
837                          }
838                  }
839                  break;
840          case WM_COMMAND:
841 +                switch (LOWORD(w))
842 +                {
843 +                case IDC_ENTER_NAME:
844 +                        {
845 +                                char name[BUFSIZ];
846 +
847 +                                GetDlgItemText(dialog, IDC_ENTER_NAME, name, BUFSIZ);
848 +
849 +                                if (name != data->client.getName())
850 +                                {
851 +                                        data->client.setName(name);
852 +                                }
853 +                        }
854 +
855 +                        if (data->client.getName() != "" && data->client.getNumber() != 0)
856 +                        {
857 +                                PropSheet_SetWizButtons(GetParent(dialog), PSWIZB_BACK |
858 +                                        PSWIZB_DISABLEDFINISH | PSWIZB_NEXT);
859 +                        }
860 +                        else
861 +                        {
862 +                                PropSheet_SetWizButtons(GetParent(dialog), PSWIZB_BACK |
863 +                                        PSWIZB_DISABLEDFINISH);
864 +                        }
865 +                        break;
866 +                case IDC_ENTER_NUM:
867 +                        {
868 +                                unsigned number = GetDlgItemInt(dialog, IDC_ENTER_NUM, NULL,
869 +                                        FALSE);
870 +
871 +                                if (number != data->client.getNumber())
872 +                                {
873 +                                        data->client.setNumber(number);
874 +                                }
875 +                        }
876 +
877 +                        if (data->client.getName() != "" && data->client.getNumber() != 0)
878 +                        {
879 +                                PropSheet_SetWizButtons(GetParent(dialog), PSWIZB_BACK |
880 +                                        PSWIZB_DISABLEDFINISH | PSWIZB_NEXT);
881 +                        }
882 +                        else
883 +                        {
884 +                                PropSheet_SetWizButtons(GetParent(dialog), PSWIZB_BACK |
885 +                                        PSWIZB_DISABLEDFINISH);
886 +                        }
887 +                        break;
888 +                }
889 +                break;
890 +        }
891 +
892 +        return FALSE;
893 + }
894 +
895 + INT_PTR ScanUtility::confirm(HWND dialog, UINT msg, WPARAM w, LPARAM l)
896 + {
897 +        ScanUtility* data = which(dialog);
898 +
899 +        switch (msg)
900 +        {
901 +        case WM_INITDIALOG:
902 +                data = which(dialog, l);
903 +
904 +                {
905 +                        ostringstream confirm;
906 +
907 +                        confirm << "Confirm the client file\'s name and size.";
908 +
909 +                        SetDlgItemText(dialog, IDC_CONFIRM_TEXT, confirm.str().c_str());
910 +                }
911 +                break;
912 +        case WM_NOTIFY:
913 +                {
914 +                        LPNMHDR nm = LPNMHDR(l);
915 +
916 +                        switch (nm->code)
917 +                        {
918 +                        case PSN_SETACTIVE:
919 +                                CheckDlgButton(dialog, IDC_CONFIRM_GOOD, BST_UNCHECKED);
920 +                                PropSheet_SetWizButtons(GetParent(dialog), PSWIZB_BACK |
921 +                                        PSWIZB_DISABLEDFINISH);
922 +                                SetDlgItemText(dialog, IDC_CONFIRM_FILE,
923 +                                        data->client.getFile().c_str());
924 +
925 +                                {
926 +                                        HANDLE scan = CreateFile(data->scan.c_str(), GENERIC_READ,
927 +                                                FILE_SHARE_READ, NULL, OPEN_EXISTING,
928 +                                                FILE_ATTRIBUTE_NORMAL, NULL);
929 +                                        DWORD bytes = GetFileSize(scan, NULL);
930 +
931 +                                        CloseHandle(scan);
932 +
933 +                                        ostringstream size;
934 +
935 +                                        size << format(bytes);
936 +
937 +                                        size.setf(ios_base::fixed, ios_base::floatfield);
938 +                                        size.precision(2);
939 +                                        
940 +                                        FLOAT megabytes = FLOAT(bytes) / FLOAT(1024 * 1024);
941 +
942 +                                        size << " bytes (" << megabytes << " MB)";
943 +
944 +                                        SetDlgItemText(dialog, IDC_CONFIRM_SIZE,
945 +                                                size.str().c_str());
946 +                                }
947 +                                break;
948 +                        case PSN_WIZBACK:
949 +                                break;
950 +                        case PSN_WIZNEXT:
951 +                                if (MoveFile(data->scan.c_str(), data->save.c_str()) == 0)
952 +                                {
953 +                                        do
954 +                                        {
955 +                                                LPVOID message;
956 +                                                
957 +                                                FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
958 +                                                        FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(), 0,
959 +                                                        LPTSTR(&message), 0, NULL);
960 +
961 +                                                int code = MessageBox(dialog, LPCTSTR(message),
962 +                                                        programName.c_str(), MB_RETRYCANCEL |
963 +                                                        MB_ICONEXCLAMATION);
964 +
965 +                                                LocalFree(message);
966 +
967 +                                                if (code == IDCANCEL)
968 +                                                {
969 +                                                        PropSheet_PressButton(GetParent(dialog),
970 +                                                                PSBTN_BACK);
971 +                                                        break;
972 +                                                }
973 +                                        }
974 +                                        while (MoveFileEx(data->scan.c_str(), data->save.c_str(),
975 +                                                MOVEFILE_REPLACE_EXISTING) == 0);
976 +                                }
977 +                                break;
978 +                        }
979 +                }
980 +                break;
981 +        case WM_COMMAND:
982 +                switch (LOWORD(w))
983 +                {
984 +                case IDC_CONFIRM_GOOD:
985 +                        if (IsDlgButtonChecked(dialog, IDC_CONFIRM_GOOD) == BST_CHECKED)
986 +                        {
987 +                                PropSheet_SetWizButtons(GetParent(dialog), PSWIZB_BACK |
988 +                                        PSWIZB_DISABLEDFINISH | PSWIZB_NEXT);
989 +                        }
990 +                        else
991 +                        {
992 +                                PropSheet_SetWizButtons(GetParent(dialog), PSWIZB_BACK |
993 +                                        PSWIZB_DISABLEDFINISH);
994 +                        }
995 +                        break;
996 +                }
997 +                break;
998 +        }
999 +
1000 +        return FALSE;
1001 + }
1002 +
1003 + INT_PTR ScanUtility::done(HWND dialog, UINT msg, WPARAM w, LPARAM l)
1004 + {
1005 +        ScanUtility* data = which(dialog);
1006 +
1007 +        switch (msg)
1008 +        {
1009 +        case WM_INITDIALOG:
1010 +                data = which(dialog, l);
1011 +
1012 +                {
1013 +                        ostringstream done;
1014 +
1015 +                        done << "You are done saving the scanned document. Click Finish to"
1016 +                                << " exit or click Back to return to the beginning.";
1017 +
1018 +                        SetDlgItemText(dialog, IDC_DONE_TEXT, done.str().c_str());
1019 +                }
1020 +                break;
1021 +        case WM_NOTIFY:
1022 +                {
1023 +                        LPNMHDR nm = LPNMHDR(l);
1024 +
1025 +                        switch (nm->code)
1026 +                        {
1027 +                        case PSN_SETACTIVE:
1028 +                                PropSheet_SetWizButtons(GetParent(dialog), PSWIZB_BACK |
1029 +                                        PSWIZB_FINISH);
1030 +                                break;
1031 +                        case PSN_WIZBACK:
1032 +                                data->client.setFile("");
1033 +                                PropSheet_SetCurSelByID(GetParent(dialog), IDD_START);
1034 +                                break;
1035 +                        case PSN_WIZFINISH:
1036 +                                break;
1037 +                        }
1038 +                }
1039                  break;
1040          }
1041  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines