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 268 by douglas, 2003-08-18T21:39:38-07:00 vs.
Revision 285 by douglas, 2003-09-02T20:40:35-07:00

# Line 2 | Line 2
2   //
3   // Douglas Thrift
4   //
5 < // $Id: VTBFileUtil2.h,v 1.8 2003/08/19 04:39:38 douglas Exp $
5 > // $Id: VTBFileUtil2.h,v 1.14 2003/09/03 03:40:35 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  
32   #include "resource.h"
33  
# Line 34 | Line 38 | struct Gui
38   {
39          HINSTANCE instance;
40          HICON icon;
41 +        int show;
42   };
43  
44   extern bool debug;
# Line 44 | Line 49 | extern Gui gui;
49  
50   void usage(HWND parent = NULL);
51   void version(HWND parent = NULL);
52 +
53 + inline string toLower(const string& mixed)
54 + {
55 +        string lower;
56 +
57 +        for (unsigned index = 0; index < mixed.length(); index++)
58 +        {
59 +                lower += tolower(mixed[index]);
60 +        }
61 +
62 +        return lower;
63 + }
64 +
65   inline string toAnsi(const wstring& wide)
66   {
67          LPSTR buffer = new CHAR[wide.length() + 1];
# Line 53 | Line 71 | inline string toAnsi(const wstring& wide
71  
72          return buffer;
73   }
74 +
75   inline wstring toWide(const string& ansi)
76   {
77          LPWSTR buffer = new WCHAR[ansi.length() + 1];
# Line 62 | Line 81 | inline wstring toWide(const string& ansi
81  
82          return buffer;
83   }
84 +
85   inline void center(HWND window)
86   {
87          RECT rect, dialog, desktop;
# Line 78 | Line 98 | inline void center(HWND window)
98                  + (rect.bottom / 2), 0, 0, SWP_NOSIZE);
99   }
100  
101 + inline void error(HWND parent = NULL)
102 + {
103 +        LPVOID message;
104 +
105 +        FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
106 +                FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(), 0,
107 +                LPTSTR(&message), 0, NULL);
108 +        MessageBox(parent, LPCTSTR(message), programName.c_str(), MB_ICONERROR);
109 +        LocalFree(message);
110 + }
111 +
112 + inline string format(DWORD value)
113 + {
114 +        ostringstream buffer;
115 +
116 +        buffer << value;
117 +
118 +        string format = buffer.str();
119 +
120 +        for (int index = format.length(), number = 0; index > 0; index -= 3,
121 +                number += 3)
122 +        {
123 +                if (index - 3 > 0)
124 +                {
125 +                        format.insert(index - 3, 1, ',');
126 +                }
127 +        }
128 +
129 +        return format;
130 + }
131 +
132   #endif // _VTBFileUtil_h_

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines