ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/proj/trunk/VTBFileUtil2/VTBFileUtil2.h
(Generate patch)

Comparing trunk/VTBFileUtil2/VTBFileUtil2.h (file contents):
Revision 257 by douglas, 2003-08-15T23:44:42-07:00 vs.
Revision 269 by douglas, 2003-08-19T01:19:24-07:00

# Line 2 | Line 2
2   //
3   // Douglas Thrift
4   //
5 < // $Id: VTBFileUtil2.h,v 1.3 2003/08/16 06:44:42 douglas Exp $
5 > // $Id: VTBFileUtil2.h,v 1.9 2003/08/19 08:19:24 douglas Exp $
6  
7   #ifndef _VTBFileUtil_h_
8   #define _VTBFileUtil_h_
# Line 16 | Line 16
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 string programVersion;
43 + extern Gui gui;
44  
45 < enum Mode { none, disc, scan };
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 < void usage(HINSTANCE instance, HWND parent = NULL);
52 < void version(HINSTANCE instance, HWND parent = NULL);
53 < void choice(Mode& mode, HINSTANCE instance, HWND parent = NULL);
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;
# Line 47 | Line 77 | inline void center(HWND window)
77          SetWindowPos(window, HWND_TOP, desktop.left + (rect.right / 2), desktop.top
78                  + (rect.bottom / 2), 0, 0, SWP_NOSIZE);
79   }
80 + inline void error(void)
81 + {
82 +        LPVOID message;
83 +
84 +        FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
85 +                FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(), 0,
86 +                LPTSTR(&message), 0, NULL);
87 +        MessageBox(NULL, LPCTSTR(message), programName.c_str(), MB_ICONERROR);
88 +        LocalFree(message);
89 + }
90  
91   #endif // _VTBFileUtil_h_

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines