2 |
|
// |
3 |
|
// Douglas Thrift |
4 |
|
// |
5 |
< |
// $Id: VTBFileUtil2.cxx,v 1.9 2003/08/18 22:25:29 douglas Exp $ |
5 |
> |
// $Id: VTBFileUtil2.cxx,v 1.10 2003/08/19 04:39:38 douglas Exp $ |
6 |
|
|
7 |
|
#include "VTBFileUtil2.h" |
8 |
|
#include "Chooser.h" |
86 |
|
vector<string> args; |
87 |
|
|
88 |
|
InitCommonControls(); |
89 |
+ |
CoInitialize(NULL); |
90 |
|
arguments(args, GetCommandLine()); |
91 |
|
|
92 |
|
program = args[0]; |
95 |
|
|
96 |
|
gui.instance = hInstance; |
97 |
|
gui.icon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_VTB_ICON)); |
97 |
– |
gui.tips = 0; |
98 |
|
|
99 |
|
for (unsigned index = 1; index < args.size(); index++) |
100 |
|
{ |
201 |
|
utility.run(); |
202 |
|
} |
203 |
|
|
204 |
+ |
CoUninitialize(); |
205 |
+ |
|
206 |
|
if (debug) |
207 |
|
{ |
208 |
|
cout << "Press enter key to exit . . ."; |
212 |
|
return 0; |
213 |
|
} |
214 |
|
|
213 |
– |
void tooltip(HWND tool, const string& tip) |
214 |
– |
{ |
215 |
– |
HWND tooltip = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, NULL, WS_POPUP |
216 |
– |
| TTS_NOPREFIX | TTS_ALWAYSTIP, CW_USEDEFAULT, CW_USEDEFAULT, |
217 |
– |
CW_USEDEFAULT, CW_USEDEFAULT, tool, NULL, gui.instance, NULL); |
218 |
– |
RECT rect; |
219 |
– |
|
220 |
– |
SetWindowPos(tooltip, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | |
221 |
– |
SWP_NOACTIVATE); |
222 |
– |
|
223 |
– |
GetClientRect(tool, &rect); |
224 |
– |
|
225 |
– |
TOOLINFO toolinfo; |
226 |
– |
LPTSTR ctip = new CHAR[tip.length()]; |
227 |
– |
|
228 |
– |
sprintf(ctip, "%s", tip.c_str()); |
229 |
– |
|
230 |
– |
if (debug) cerr << "ctip = " << ctip << "\n"; |
231 |
– |
|
232 |
– |
toolinfo.cbSize = sizeof(TOOLINFO); |
233 |
– |
toolinfo.uFlags = TTF_SUBCLASS; |
234 |
– |
toolinfo.hwnd = tool; |
235 |
– |
toolinfo.hinst = gui.instance; |
236 |
– |
toolinfo.uId = gui.tips++; |
237 |
– |
toolinfo.lpszText = ctip; |
238 |
– |
toolinfo.rect.left = rect.left; |
239 |
– |
toolinfo.rect.top = rect.top; |
240 |
– |
toolinfo.rect.right = rect.right; |
241 |
– |
toolinfo.rect.bottom = rect.bottom; |
242 |
– |
|
243 |
– |
SendMessage(tooltip, TTM_ADDTOOL, 0, LPARAM(LPTOOLINFO(&toolinfo))); |
244 |
– |
|
245 |
– |
delete [] ctip; |
246 |
– |
} |
247 |
– |
|
215 |
|
INT_PTR CALLBACK usage(HWND dialog, UINT msg, WPARAM w, LPARAM l) |
216 |
|
{ |
217 |
|
switch (msg) |