4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Angus Leeming
9 * Full author contact details are available in file CREDITS.
11 * These classes should be used only on Windows machines.
20 # error os_win32.h should be compiled only under Windows.
23 /* The GetLongPathNameA function declaration in
24 * <winbase.h> is protected by the WINVER macro which is
25 * defined to a default value in <windef.h> under MinGW and Cygwin.
27 * SHGFP_TYPE_CURRENT is defined in <shlobj.h> for __W32API_VERSION >= 3.2
28 * where it is protected by _WIN32_IE, also defined to a default value
29 * in <windef.h> under MinGW and Cygwin.
30 * It is missing in earlier versions of the MinGW w32api headers.
32 * We need to #include <windows.h> now to make available the
33 * DWORD, HMODULE et al. typedefs, so first define WINVER, _WIN32_IE.
35 * Note: __CYGWIN__ can be defined here if building in _WIN32 mode.
37 #if defined(__MINGW32__) || defined(__CYGWIN__) || defined(__CYGWIN32__)
38 # if defined(WINVER) && WINVER < 0x0500
39 # error WINVER must be >= 0x0500
41 # define WINVER 0x0500
42 # define _WIN32_IE 0x0500
52 /** Win98 and earlier don't have SHGetFolderPath in shell32.dll.
53 * Microsoft recommend that we load shfolder.dll at run time and
54 * access the function through that.
56 * shfolder.dll is loaded dynamically in the constructor. If loading
57 * fails or if the .dll is found not to contain SHGetFolderPathA then
58 * the program exits immediately. Otherwise, the .dll is unloaded in
61 * The class makes SHGetFolderPath available through its function operator.
62 * It will work on all versions of Windows >= Win95.
76 /** Wrapper for SHGetFolderPathA, returning
77 * the path asscociated with @c id.
79 std::string const operator()(folder_id id) const;
81 typedef HRESULT (__stdcall * function_pointer)(HWND, int, HANDLE, DWORD, LPCSTR);
83 HMODULE folder_module_;
84 function_pointer folder_path_func_;
88 } // namespace support