2 |
|
// |
3 |
|
// Douglas Thrift |
4 |
|
// |
5 |
< |
// $Id: ScanUtility.cxx,v 1.1 2003/08/16 09:08:35 douglas Exp $ |
5 |
> |
// $Id: ScanUtility.cxx,v 1.3 2003/08/19 04:39:38 douglas Exp $ |
6 |
|
|
7 |
|
#include "ScanUtility.h" |
8 |
+ |
|
9 |
+ |
ScanUtility::ScanUtility() |
10 |
+ |
{ |
11 |
+ |
number = count++; |
12 |
+ |
utilities.insert(pair<unsigned, ScanUtility*>(number, this)); |
13 |
+ |
title = new char[programName.length() + 16]; |
14 |
+ |
|
15 |
+ |
sprintf(title, "%s - Scan Utility", programName.c_str()); |
16 |
+ |
|
17 |
+ |
PROPSHEETPAGE page; |
18 |
+ |
|
19 |
+ |
// start |
20 |
+ |
page.dwSize = sizeof(page); |
21 |
+ |
page.dwFlags = PSP_DEFAULT | PSP_USEHICON | PSP_USETITLE | |
22 |
+ |
PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE; |
23 |
+ |
page.hInstance = gui.instance; |
24 |
+ |
page.pszTemplate = MAKEINTRESOURCE(IDD_SCAN_START); |
25 |
+ |
page.hIcon = gui.icon; |
26 |
+ |
page.pszTitle = title; |
27 |
+ |
page.pfnDlgProc = start; |
28 |
+ |
page.lParam = number; |
29 |
+ |
page.pszHeaderTitle = "Start"; |
30 |
+ |
page.pszHeaderSubTitle = "Change any settings before scanning."; |
31 |
+ |
|
32 |
+ |
wizard[0] = CreatePropertySheetPage(&page); |
33 |
+ |
} |
34 |
+ |
|
35 |
+ |
ScanUtility::~ScanUtility() |
36 |
+ |
{ |
37 |
+ |
utilities.erase(number); |
38 |
+ |
delete [] title; |
39 |
+ |
} |
40 |
+ |
|
41 |
+ |
void ScanUtility::run(void) |
42 |
+ |
{ |
43 |
+ |
PROPSHEETHEADER header; |
44 |
+ |
|
45 |
+ |
// header |
46 |
+ |
header.dwSize = sizeof(header); |
47 |
+ |
header.dwFlags = PSH_DEFAULT | PSH_USEICONID | PSH_WIZARD97; |
48 |
+ |
header.hwndParent = NULL; |
49 |
+ |
header.hInstance = gui.instance; |
50 |
+ |
header.pszIcon = MAKEINTRESOURCE(IDI_VTB_ICON); |
51 |
+ |
header.nPages = 1; |
52 |
+ |
header.nStartPage = 0; |
53 |
+ |
header.phpage = wizard; |
54 |
+ |
|
55 |
+ |
PropertySheet(&header); |
56 |
+ |
} |
57 |
+ |
|
58 |
+ |
unsigned ScanUtility::count = 0; |
59 |
+ |
map<unsigned, ScanUtility*> ScanUtility::utilities; |
60 |
+ |
map<HWND, ScanUtility*> ScanUtility::windows; |
61 |
+ |
|
62 |
+ |
INT_PTR ScanUtility::start(HWND dialog, UINT msg, WPARAM w, LPARAM l) |
63 |
+ |
{ |
64 |
+ |
map<HWND, ScanUtility*>::iterator itor = windows.find(dialog); |
65 |
+ |
ScanUtility* data = itor->second; |
66 |
+ |
|
67 |
+ |
switch (msg) |
68 |
+ |
{ |
69 |
+ |
case WM_INITDIALOG: |
70 |
+ |
{ |
71 |
+ |
map<unsigned, ScanUtility*>::iterator itor = utilities.find(l); |
72 |
+ |
|
73 |
+ |
windows.insert(pair<HWND, ScanUtility*>(dialog, itor->second)); |
74 |
+ |
} |
75 |
+ |
break; |
76 |
+ |
} |
77 |
+ |
|
78 |
+ |
return FALSE; |
79 |
+ |
} |