tagging release
[dasher.git] / trunk / Src / Win32 / Common / WinHelper.h
blob7e05fb915671a2b5ee880c5d9efaef2928d375d1
1 // WinHelper.h
2 //
3 /////////////////////////////////////////////////////////////////////////////
4 //
5 // Copyright (c) 2002 Iain Murray, Inference Group, Cavendish, Cambridge.
6 //
7 /////////////////////////////////////////////////////////////////////////////
9 #ifndef __WinHelper_h__
10 #define __WinHelper_h__
12 #define NOMINMAX
13 #define WIN32_LEAN_AND_MEAN // Excludes rarely-used stuff from the Windows headers
14 #include <windows.h>
15 #include <winbase.h>
16 #include <Commdlg.h>
19 Initialise Common Controls library. If we want this to work with Windows 95
20 with no extra dll's or versions of IE installed, we define OriginalWin95 and
21 play games with macros. Having said that, almost all Windows systems should
22 have the required DLL for new common control features (either with the system
23 or with IE). If not it is an easy upgrade from:
24 http://www.microsoft.com/msdownload/ieplatform/ie/comctrlx86.asp
26 IAM 08/2002
28 #ifdef OriginalWin95
29 #define _WIN32_IE_TMP _WIN32_IE
30 #undef _WIN32_IE
31 #define _WIN32_IE 0x0100
32 #endif
34 #include <commctrl.h>
36 #ifdef OriginalWin95
37 #undef _WIN32_IE
38 #define _WIN32_IE _WIN32_IE_TMP
39 #undef _WIN32_IE_TMP
40 #endif
42 #ifdef OriginalWin95
43 #undef CP_UTF8 // as we can't use it
44 #endif
46 // windows.h provides the "generic" character type TCHAR.
47 #include "tchar.h" // this adds some useful macros
48 // Sometimes it is much easier to use strings, for which we now have Tstring.
49 #include <string>
50 typedef std::basic_string < TCHAR > Tstring;
52 // Some global helpers. In all my applications there is just one instance,
53 // or one important one, and WinHelper::hInstApp saves passing it around endlessly
54 namespace WinHelper {
55 extern HINSTANCE hInstApp;
56 void LastWindowsError();
57 void InitCommonControlLib();
58 void GetUserDirectory(Tstring * Output); // Both thof these will always
59 void GetAppDirectory(Tstring * Output); // return a trailing "\"
61 #endif /* #ifndef __WinHelper_h__ */