2 |
|
// |
3 |
|
// Douglas Thrift |
4 |
|
// |
5 |
< |
// $Id: VTBFileUtil2.h,v 1.1 2003/08/16 00:12:57 douglas Exp $ |
5 |
> |
// $Id: VTBFileUtil2.h,v 1.8 2003/08/19 04:39:38 douglas Exp $ |
6 |
|
|
7 |
|
#ifndef _VTBFileUtil_h_ |
8 |
|
#define _VTBFileUtil_h_ |
16 |
|
#include <sstream> |
17 |
|
#include <cctype> |
18 |
|
#include <vector> |
19 |
+ |
#include <set> |
20 |
+ |
#include <map> |
21 |
+ |
#include <cstdlib> |
22 |
|
|
23 |
|
#include <windows.h> |
24 |
+ |
#include <commctrl.h> |
25 |
+ |
#include <objbase.h> |
26 |
+ |
#include <shlobj.h> |
27 |
+ |
|
28 |
+ |
#include "resource.h" |
29 |
|
|
30 |
|
using namespace std; |
31 |
|
|
32 |
+ |
enum Mode { none, disc, scan }; |
33 |
+ |
struct Gui |
34 |
+ |
{ |
35 |
+ |
HINSTANCE instance; |
36 |
+ |
HICON icon; |
37 |
+ |
}; |
38 |
+ |
|
39 |
|
extern bool debug; |
40 |
|
extern string program; |
41 |
|
extern string programName; |
42 |
< |
extern unsigned programVersion; |
42 |
> |
extern string programVersion; |
43 |
> |
extern Gui gui; |
44 |
|
|
45 |
< |
void usage(void); |
46 |
< |
void version(void); |
45 |
> |
void usage(HWND parent = NULL); |
46 |
> |
void version(HWND parent = NULL); |
47 |
> |
inline string toAnsi(const wstring& wide) |
48 |
> |
{ |
49 |
> |
LPSTR buffer = new CHAR[wide.length() + 1]; |
50 |
> |
|
51 |
> |
WideCharToMultiByte(CP_ACP, 0, wide.c_str(), wide.length() + 1, buffer, |
52 |
> |
wide.length() + 1, NULL, NULL); |
53 |
> |
|
54 |
> |
return buffer; |
55 |
> |
} |
56 |
> |
inline wstring toWide(const string& ansi) |
57 |
> |
{ |
58 |
> |
LPWSTR buffer = new WCHAR[ansi.length() + 1]; |
59 |
> |
|
60 |
> |
MultiByteToWideChar(CP_ACP, 0, ansi.c_str(), ansi.length() + 1, buffer, |
61 |
> |
ansi.length() + 1); |
62 |
> |
|
63 |
> |
return buffer; |
64 |
> |
} |
65 |
> |
inline void center(HWND window) |
66 |
> |
{ |
67 |
> |
RECT rect, dialog, desktop; |
68 |
> |
|
69 |
> |
GetWindowRect(GetDesktopWindow(), &desktop); |
70 |
> |
GetWindowRect(window, &dialog); |
71 |
> |
CopyRect(&rect, &desktop); |
72 |
> |
|
73 |
> |
OffsetRect(&dialog, -dialog.left, -dialog.top); |
74 |
> |
OffsetRect(&rect, -rect.left, -rect.top); |
75 |
> |
OffsetRect(&rect, -dialog.right, -dialog.bottom); |
76 |
> |
|
77 |
> |
SetWindowPos(window, HWND_TOP, desktop.left + (rect.right / 2), desktop.top |
78 |
> |
+ (rect.bottom / 2), 0, 0, SWP_NOSIZE); |
79 |
> |
} |
80 |
|
|
81 |
|
#endif // _VTBFileUtil_h_ |