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 278 by douglas, 2003-08-25T00:29:00-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.12 2003/08/25 07:29:00 douglas Exp $
6  
7   #ifndef _VTBFileUtil_h_
8   #define _VTBFileUtil_h_
# Line 12 | Line 12
12   #endif // _DEBUG
13  
14   #include <iostream>
15 + #include <locale>
16   #include <string>
17   #include <sstream>
18   #include <cctype>
# Line 21 | Line 22
22   #include <cstdlib>
23  
24   #include <windows.h>
25 + #include <windowsx.h>
26   #include <commctrl.h>
27   #include <objbase.h>
28   #include <shlobj.h>
# Line 35 | Line 37 | struct Gui
37   {
38          HINSTANCE instance;
39          HICON icon;
40 +        int show;
41   };
42  
43   extern bool debug;
# Line 45 | Line 48 | extern Gui gui;
48  
49   void usage(HWND parent = NULL);
50   void version(HWND parent = NULL);
51 +
52   inline string toAnsi(const wstring& wide)
53   {
54          LPSTR buffer = new CHAR[wide.length() + 1];
# Line 54 | Line 58 | inline string toAnsi(const wstring& wide
58  
59          return buffer;
60   }
61 +
62   inline wstring toWide(const string& ansi)
63   {
64          LPWSTR buffer = new WCHAR[ansi.length() + 1];
# Line 63 | Line 68 | inline wstring toWide(const string& ansi
68  
69          return buffer;
70   }
71 +
72   inline void center(HWND window)
73   {
74          RECT rect, dialog, desktop;
# Line 78 | Line 84 | inline void center(HWND window)
84          SetWindowPos(window, HWND_TOP, desktop.left + (rect.right / 2), desktop.top
85                  + (rect.bottom / 2), 0, 0, SWP_NOSIZE);
86   }
87 < inline void error(void)
87 >
88 > inline void error(HWND parent = NULL)
89   {
90          LPVOID message;
91  
92          FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
93                  FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(), 0,
94                  LPTSTR(&message), 0, NULL);
95 <        MessageBox(NULL, LPCTSTR(message), programName.c_str(), MB_ICONERROR);
95 >        MessageBox(parent, LPCTSTR(message), programName.c_str(), MB_ICONERROR);
96          LocalFree(message);
97   }
98  
99 + inline string format(DWORD value)
100 + {
101 +        ostringstream buffer;
102 +
103 +        buffer << value;
104 +
105 +        string format = buffer.str();
106 +
107 +        for (int index = format.length(), number = 0; index > 0; index -= 3,
108 +                number += 3)
109 +        {
110 +                if (index - 3 > 0)
111 +                {
112 +                        format.insert(index - 3, 1, ',');
113 +                }
114 +        }
115 +
116 +        return format;
117 + }
118 +
119   #endif // _VTBFileUtil_h_

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines