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 277 by douglas, 2003-08-24T00:31:45-07:00 vs.
Revision 279 by douglas, 2003-08-25T01:08:18-07:00

# Line 2 | Line 2
2   //
3   // Douglas Thrift
4   //
5 < // $Id: VTBFileUtil2.h,v 1.11 2003/08/24 07:31:45 douglas Exp $
5 > // $Id: VTBFileUtil2.h,v 1.13 2003/08/25 08:08:18 douglas Exp $
6  
7   #ifndef _VTBFileUtil_h_
8   #define _VTBFileUtil_h_
# Line 47 | Line 47 | extern Gui gui;
47  
48   void usage(HWND parent = NULL);
49   void version(HWND parent = NULL);
50 +
51   inline string toAnsi(const wstring& wide)
52   {
53          LPSTR buffer = new CHAR[wide.length() + 1];
# Line 56 | Line 57 | inline string toAnsi(const wstring& wide
57  
58          return buffer;
59   }
60 +
61   inline wstring toWide(const string& ansi)
62   {
63          LPWSTR buffer = new WCHAR[ansi.length() + 1];
# Line 65 | Line 67 | inline wstring toWide(const string& ansi
67  
68          return buffer;
69   }
70 +
71   inline void center(HWND window)
72   {
73          RECT rect, dialog, desktop;
# Line 80 | Line 83 | inline void center(HWND window)
83          SetWindowPos(window, HWND_TOP, desktop.left + (rect.right / 2), desktop.top
84                  + (rect.bottom / 2), 0, 0, SWP_NOSIZE);
85   }
86 < inline void error(void)
86 >
87 > inline void error(HWND parent = NULL)
88   {
89          LPVOID message;
90  
91          FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
92                  FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(), 0,
93                  LPTSTR(&message), 0, NULL);
94 <        MessageBox(NULL, LPCTSTR(message), programName.c_str(), MB_ICONERROR);
94 >        MessageBox(parent, LPCTSTR(message), programName.c_str(), MB_ICONERROR);
95          LocalFree(message);
96   }
97  
98 + inline string format(DWORD value)
99 + {
100 +        ostringstream buffer;
101 +
102 +        buffer << value;
103 +
104 +        string format = buffer.str();
105 +
106 +        for (int index = format.length(), number = 0; index > 0; index -= 3,
107 +                number += 3)
108 +        {
109 +                if (index - 3 > 0)
110 +                {
111 +                        format.insert(index - 3, 1, ',');
112 +                }
113 +        }
114 +
115 +        return format;
116 + }
117 +
118   #endif // _VTBFileUtil_h_

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines