ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/proj/trunk/VTBFileUtil2/VTBFileUtil2.h
Revision: 264
Committed: 2003-08-16T17:43:49-07:00 (21 years, 10 months ago) by douglas
Content type: text/x-c
File size: 1695 byte(s)
Log Message:
It creates shortcuts.

File Contents

# User Rev Content
1 douglas 255 // Vance Thrift and Biller File Utility 2
2     //
3     // Douglas Thrift
4     //
5 douglas 264 // $Id: VTBFileUtil2.h,v 1.6 2003/08/17 00:43:49 douglas Exp $
6 douglas 255
7     #ifndef _VTBFileUtil_h_
8     #define _VTBFileUtil_h_
9    
10     #ifdef _DEBUG
11     #pragma warning(disable:4786)
12     #endif // _DEBUG
13    
14     #include <iostream>
15     #include <string>
16     #include <sstream>
17     #include <cctype>
18     #include <vector>
19 douglas 259 #include <cstdlib>
20 douglas 255
21     #include <windows.h>
22 douglas 257 #include <commctrl.h>
23 douglas 264 #include <objbase.h>
24     #include <shlobj.h>
25 douglas 255
26 douglas 262 #include "resource.h"
27    
28 douglas 255 using namespace std;
29    
30 douglas 262 enum Mode { none, disc, scan };
31     struct Gui
32     {
33     HINSTANCE instance;
34     HICON icon;
35     UINT_PTR tips;
36     };
37    
38 douglas 255 extern bool debug;
39     extern string program;
40     extern string programName;
41 douglas 256 extern string programVersion;
42 douglas 262 extern Gui gui;
43 douglas 255
44 douglas 259 void usage(HWND parent = NULL);
45     void version(HWND parent = NULL);
46 douglas 264 inline string toAnsi(const wstring& wide)
47     {
48     LPSTR buffer = new CHAR[wide.length() + 1];
49    
50     WideCharToMultiByte(CP_ACP, 0, wide.c_str(), wide.length() + 1, buffer,
51     wide.length() + 1, NULL, NULL);
52    
53     return buffer;
54     }
55     inline wstring toWide(const string& ansi)
56     {
57     LPWSTR buffer = new WCHAR[ansi.length() + 1];
58    
59     MultiByteToWideChar(CP_ACP, 0, ansi.c_str(), ansi.length() + 1, buffer,
60     ansi.length() + 1);
61    
62     return buffer;
63     }
64 douglas 256 inline void center(HWND window)
65     {
66     RECT rect, dialog, desktop;
67 douglas 255
68 douglas 256 GetWindowRect(GetDesktopWindow(), &desktop);
69     GetWindowRect(window, &dialog);
70     CopyRect(&rect, &desktop);
71    
72     OffsetRect(&dialog, -dialog.left, -dialog.top);
73     OffsetRect(&rect, -rect.left, -rect.top);
74     OffsetRect(&rect, -dialog.right, -dialog.bottom);
75    
76     SetWindowPos(window, HWND_TOP, desktop.left + (rect.right / 2), desktop.top
77     + (rect.bottom / 2), 0, 0, SWP_NOSIZE);
78     }
79 douglas 259 void tooltip(HWND tool, const string& tip);
80 douglas 256
81 douglas 255 #endif // _VTBFileUtil_h_