2 |
|
// |
3 |
|
// Douglas Thrift |
4 |
|
// |
5 |
< |
// $Id: VTBFileUtil2.cxx,v 1.7 2003/08/17 00:43:49 douglas Exp $ |
5 |
> |
// $Id: VTBFileUtil2.cxx,v 1.12 2003/08/24 07:31:45 douglas Exp $ |
6 |
|
|
7 |
|
#include "VTBFileUtil2.h" |
8 |
|
#include "Chooser.h" |
39 |
|
line.get(); |
40 |
|
} |
41 |
|
|
42 |
< |
args.push_back(arg); |
42 |
> |
if (arg != "") |
43 |
> |
{ |
44 |
> |
args.push_back(arg); |
45 |
> |
} |
46 |
|
} |
47 |
|
while (line.good()); |
48 |
|
} |
89 |
|
vector<string> args; |
90 |
|
|
91 |
|
InitCommonControls(); |
92 |
+ |
CoInitialize(NULL); |
93 |
|
arguments(args, GetCommandLine()); |
94 |
|
|
95 |
|
program = args[0]; |
98 |
|
|
99 |
|
gui.instance = hInstance; |
100 |
|
gui.icon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_VTB_ICON)); |
101 |
< |
gui.tips = 0; |
101 |
> |
gui.show = nShowCmd; |
102 |
|
|
103 |
|
for (unsigned index = 1; index < args.size(); index++) |
104 |
|
{ |
194 |
|
|
195 |
|
if (mode == disc) |
196 |
|
{ |
197 |
< |
MessageBox(NULL, "Disc Browse mode", programName.c_str(), |
198 |
< |
MB_ICONINFORMATION); |
197 |
> |
DiscBrowse browser; |
198 |
> |
|
199 |
> |
browser.run(); |
200 |
|
} |
201 |
|
else if (mode == scan) |
202 |
|
{ |
203 |
< |
MessageBox(NULL, "Scan Utility mode", programName.c_str(), |
204 |
< |
MB_ICONINFORMATION); |
203 |
> |
ScanUtility utility; |
204 |
> |
|
205 |
> |
utility.run(); |
206 |
|
} |
207 |
|
|
208 |
+ |
CoUninitialize(); |
209 |
+ |
|
210 |
|
if (debug) |
211 |
|
{ |
212 |
|
cout << "Press enter key to exit . . ."; |
216 |
|
return 0; |
217 |
|
} |
218 |
|
|
211 |
– |
void tooltip(HWND tool, const string& tip) |
212 |
– |
{ |
213 |
– |
HWND tooltip = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, NULL, WS_POPUP |
214 |
– |
| TTS_NOPREFIX | TTS_ALWAYSTIP, CW_USEDEFAULT, CW_USEDEFAULT, |
215 |
– |
CW_USEDEFAULT, CW_USEDEFAULT, tool, NULL, gui.instance, NULL); |
216 |
– |
RECT rect; |
217 |
– |
|
218 |
– |
SetWindowPos(tooltip, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | |
219 |
– |
SWP_NOACTIVATE); |
220 |
– |
|
221 |
– |
GetClientRect(tool, &rect); |
222 |
– |
|
223 |
– |
TOOLINFO toolinfo; |
224 |
– |
LPTSTR ctip = new CHAR[tip.length()]; |
225 |
– |
|
226 |
– |
sprintf(ctip, "%s", tip.c_str()); |
227 |
– |
|
228 |
– |
if (debug) cerr << "ctip = " << ctip << "\n"; |
229 |
– |
|
230 |
– |
toolinfo.cbSize = sizeof(TOOLINFO); |
231 |
– |
toolinfo.uFlags = TTF_SUBCLASS; |
232 |
– |
toolinfo.hwnd = tool; |
233 |
– |
toolinfo.hinst = gui.instance; |
234 |
– |
toolinfo.uId = gui.tips++; |
235 |
– |
toolinfo.lpszText = ctip; |
236 |
– |
toolinfo.rect.left = rect.left; |
237 |
– |
toolinfo.rect.top = rect.top; |
238 |
– |
toolinfo.rect.right = rect.right; |
239 |
– |
toolinfo.rect.bottom = rect.bottom; |
240 |
– |
|
241 |
– |
SendMessage(tooltip, TTM_ADDTOOL, 0, LPARAM(LPTOOLINFO(&toolinfo))); |
242 |
– |
} |
243 |
– |
|
219 |
|
INT_PTR CALLBACK usage(HWND dialog, UINT msg, WPARAM w, LPARAM l) |
220 |
|
{ |
221 |
|
switch (msg) |
234 |
|
<< " -disc\t\tStart in Disc Browse mode\n" |
235 |
|
<< " -scan\t\tStart in Scan Utility mode\n"; |
236 |
|
|
237 |
< |
SendMessage(GetDlgItem(dialog, IDC_USAGE_TEXT), WM_SETTEXT, 0, |
263 |
< |
LPARAM(usage.str().c_str())); |
237 |
> |
SetDlgItemText(dialog, IDC_USAGE_TEXT, usage.str().c_str()); |
238 |
|
} |
239 |
|
break; |
240 |
|
case WM_COMMAND: |
267 |
|
version << programName << " (" << programVersion << ")\n\n" |
268 |
|
<< "Copyright © 2003, Douglas Thrift.\n"; |
269 |
|
|
270 |
< |
SendMessage(GetDlgItem(dialog, IDC_VERSION_TEXT), WM_SETTEXT, 0, |
297 |
< |
LPARAM(version.str().c_str())); |
270 |
> |
SetDlgItemText(dialog, IDC_VERSION_TEXT, version.str().c_str()); |
271 |
|
} |
272 |
|
break; |
273 |
|
case WM_COMMAND: |