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 271 by douglas, 2003-08-19T22:49:34-07:00 vs.
Revision 286 by douglas, 2003-09-02T21:12:41-07:00

# Line 2 | Line 2
2   //
3   // Douglas Thrift
4   //
5 < // $Id: VTBFileUtil2.h,v 1.10 2003/08/20 05:49:34 douglas Exp $
5 > // $Id: VTBFileUtil2.h,v 1.15 2003/09/03 04:12:41 douglas Exp $
6  
7   #ifndef _VTBFileUtil_h_
8   #define _VTBFileUtil_h_
# Line 20 | Line 20
20   #include <map>
21   #include <cstdlib>
22  
23 + #define _WIN32_IE 0x0500
24 +
25   #include <windows.h>
26 + #include <windowsx.h>
27   #include <commctrl.h>
28   #include <objbase.h>
29   #include <shlobj.h>
30   #include <shlwapi.h>
31 + #include <richedit.h>
32  
33   #include "resource.h"
34  
# Line 35 | Line 39 | struct Gui
39   {
40          HINSTANCE instance;
41          HICON icon;
42 +        int show;
43   };
44  
45   extern bool debug;
# Line 45 | Line 50 | extern Gui gui;
50  
51   void usage(HWND parent = NULL);
52   void version(HWND parent = NULL);
53 +
54 + inline string toLower(const string& mixed)
55 + {
56 +        string lower;
57 +
58 +        for (unsigned index = 0; index < mixed.length(); index++)
59 +        {
60 +                lower += tolower(mixed[index]);
61 +        }
62 +
63 +        return lower;
64 + }
65 +
66   inline string toAnsi(const wstring& wide)
67   {
68          LPSTR buffer = new CHAR[wide.length() + 1];
# Line 54 | Line 72 | inline string toAnsi(const wstring& wide
72  
73          return buffer;
74   }
75 +
76   inline wstring toWide(const string& ansi)
77   {
78          LPWSTR buffer = new WCHAR[ansi.length() + 1];
# Line 63 | Line 82 | inline wstring toWide(const string& ansi
82  
83          return buffer;
84   }
85 +
86   inline void center(HWND window)
87   {
88          RECT rect, dialog, desktop;
# Line 78 | Line 98 | inline void center(HWND window)
98          SetWindowPos(window, HWND_TOP, desktop.left + (rect.right / 2), desktop.top
99                  + (rect.bottom / 2), 0, 0, SWP_NOSIZE);
100   }
101 < inline void error(void)
101 >
102 > inline void error(HWND parent = NULL)
103   {
104          LPVOID message;
105  
106          FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
107                  FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(), 0,
108                  LPTSTR(&message), 0, NULL);
109 <        MessageBox(NULL, LPCTSTR(message), programName.c_str(), MB_ICONERROR);
109 >        MessageBox(parent, LPCTSTR(message), programName.c_str(), MB_ICONERROR);
110          LocalFree(message);
111   }
112  
113 + inline string format(DWORD value)
114 + {
115 +        ostringstream buffer;
116 +
117 +        buffer << value;
118 +
119 +        string format = buffer.str();
120 +
121 +        for (int index = format.length(), number = 0; index > 0; index -= 3,
122 +                number += 3)
123 +        {
124 +                if (index - 3 > 0)
125 +                {
126 +                        format.insert(index - 3, 1, ',');
127 +                }
128 +        }
129 +
130 +        return format;
131 + }
132 +
133   #endif // _VTBFileUtil_h_

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines