2 |
|
// |
3 |
|
// Douglas Thrift |
4 |
|
// |
5 |
< |
// $Id: VTBFileUtil2.cxx,v 1.13 2003/09/05 08:57:00 douglas Exp $ |
5 |
> |
// $Id: VTBFileUtil2.cxx,v 1.15 2003/09/12 04:26:54 douglas Exp $ |
6 |
|
|
7 |
|
#include "VTBFileUtil2.h" |
8 |
|
#include "Chooser.h" |
15 |
|
bool debug = false; |
16 |
|
string program; |
17 |
|
string programName = "Vance Thrift and Biller File Utility 2"; |
18 |
< |
string programVersion = "2.0beta"; |
18 |
> |
string programVersion = "2.0"; |
19 |
|
Gui gui; |
20 |
|
|
21 |
|
static INT_PTR CALLBACK usage(HWND dialog, UINT msg, WPARAM w, LPARAM l); |
100 |
|
gui.icon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_VTB_ICON)); |
101 |
|
gui.show = nShowCmd; |
102 |
|
|
103 |
+ |
if (toAnsi(toWide("Z:\\DouglasThrift")) != "Z:\\DouglasThrift") |
104 |
+ |
{ |
105 |
+ |
string message = "Could not find the Microsoft Layer for Unicode."; |
106 |
+ |
|
107 |
+ |
switch (MessageBox(NULL, message.c_str(), programName.c_str(), |
108 |
+ |
MB_ABORTRETRYIGNORE | MB_ICONERROR)) |
109 |
+ |
{ |
110 |
+ |
case IDABORT: |
111 |
+ |
return 1; |
112 |
+ |
break; |
113 |
+ |
case IDRETRY: |
114 |
+ |
{ |
115 |
+ |
string url = string("http://www.microsoft.com/downloads/detai") |
116 |
+ |
+ "ls.aspx?FamilyID=73ba7bd7-ed06-4f0d-80a4-2a7eeaee17e2&D" |
117 |
+ |
+ "isplayLang=en", message = string("Click OK when the Mi") |
118 |
+ |
+ "crosoft Layer for Unicode is installed."; |
119 |
+ |
|
120 |
+ |
ShellExecute(NULL, NULL, url.c_str(), NULL, NULL, gui.show); |
121 |
+ |
MessageBox(NULL, message.c_str(), programName.c_str(), MB_OK | |
122 |
+ |
MB_ICONINFORMATION); |
123 |
+ |
|
124 |
+ |
STARTUPINFO start; |
125 |
+ |
PROCESS_INFORMATION info; |
126 |
+ |
|
127 |
+ |
start.cb = sizeof(start); |
128 |
+ |
start.lpReserved = NULL; |
129 |
+ |
start.lpDesktop = NULL; |
130 |
+ |
start.lpTitle = NULL; |
131 |
+ |
start.dwFlags = STARTF_FORCEONFEEDBACK | STARTF_USESHOWWINDOW; |
132 |
+ |
start.wShowWindow = gui.show; |
133 |
+ |
start.cbReserved2 = 0; |
134 |
+ |
start.lpReserved2 = NULL; |
135 |
+ |
|
136 |
+ |
CreateProcess(program.c_str(), GetCommandLine(), NULL, NULL, |
137 |
+ |
FALSE, 0, NULL, NULL, &start, &info); |
138 |
+ |
CloseHandle(info.hProcess); |
139 |
+ |
CloseHandle(info.hThread); |
140 |
+ |
} |
141 |
+ |
return 0; |
142 |
+ |
break; |
143 |
+ |
case IDIGNORE: |
144 |
+ |
break; |
145 |
+ |
} |
146 |
+ |
} |
147 |
+ |
|
148 |
|
for (unsigned index = 1; index < args.size(); index++) |
149 |
|
{ |
150 |
|
if (args[index] == "-help") |
258 |
|
|
259 |
|
if (debug) |
260 |
|
{ |
261 |
< |
cout << "Press enter key to exit . . ."; |
262 |
< |
cin.get(); |
261 |
> |
char cmd[MAX_PATH]; |
262 |
> |
char arg[MAX_PATH]; |
263 |
> |
|
264 |
> |
GetEnvironmentVariable("ComSpec", cmd, MAX_PATH); |
265 |
> |
StringCchPrintf(arg, MAX_PATH, "%s /c pause", cmd); |
266 |
> |
|
267 |
> |
STARTUPINFO start; |
268 |
> |
PROCESS_INFORMATION info; |
269 |
> |
|
270 |
> |
start.cb = sizeof(start); |
271 |
> |
start.lpReserved = NULL; |
272 |
> |
start.lpDesktop = NULL; |
273 |
> |
start.lpTitle = NULL; |
274 |
> |
start.dwFlags = STARTF_USESTDHANDLES; |
275 |
> |
start.cbReserved2 = 0; |
276 |
> |
start.lpReserved2 = NULL; |
277 |
> |
start.hStdInput = GetStdHandle(STD_INPUT_HANDLE); |
278 |
> |
start.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE); |
279 |
> |
start.hStdError = GetStdHandle(STD_ERROR_HANDLE); |
280 |
> |
|
281 |
> |
CreateProcess(cmd, arg, NULL, NULL, TRUE, 0, NULL, NULL, &start, &info); |
282 |
> |
CloseHandle(info.hProcess); |
283 |
> |
CloseHandle(info.hThread); |
284 |
|
} |
285 |
|
|
286 |
|
return 0; |