# win32.h

Go to the documentation of this file.

    00001 /* $Id: win32.h 9055 2007-03-07 18:58:28Z Darkvater $ */
    00002
    00005 #ifndef WIN32_H
    00006 #define WIN32_H
    00007
    00008 #include <windows.h>
    00009 bool MyShowCursor(bool show);
    00010
    00011 typedef void (*Function)(int);
    00012 bool LoadLibraryList(Function proc[], const char *dll);
    00013
    00014 char *convert_from_fs(const wchar_t *name, char *utf8_buf, size_t buflen);
    00015 wchar_t *convert_to_fs(const char *name, wchar_t *utf16_buf, size_t buflen);
    00016
    00017 /* Function shortcuts for UTF-8 <> UNICODE conversion. When unicode is not
    00018  * defined these macros return the string passed to them, with UNICODE
    00019  * they return a pointer to the converted string. The only difference between
    00020  * XX_TO_YY and XX_TO_YY_BUFFER is that with the buffer variant you can
    00021  * specify where to put the converted string (and how long it can be). Without
    00022  * the buffer and internal buffer is used, of max 512 characters */
    00023 #if defined(UNICODE)
    00024 # define MB_TO_WIDE(str) OTTD2FS(str)
    00025 # define MB_TO_WIDE_BUFFER(str, buffer, buflen) convert_to_fs(str, buffer, buflen)
    00026 # define WIDE_TO_MB(str) FS2OTTD(str)
    00027 # define WIDE_TO_MB_BUFFER(str, buffer, buflen) convert_from_fs(str, buffer, buflen)
    00028 #else
    00029 extern uint _codepage; // local code-page in the system @see win32_v.cpp:WM_INPUTLANGCHANGE
    00030 # define MB_TO_WIDE(str) (str)
    00031 # define MB_TO_WIDE_BUFFER(str, buffer, buflen) (str)
    00032 # define WIDE_TO_MB(str) (str)
    00033 # define WIDE_TO_MB_BUFFER(str, buffer, buflen) (str)
    00034 #endif
    00035
    00036 /* Override SHGetFolderPath with our custom implementation */
    00037 #if defined(SHGetFolderPath)
    00038 #undef SHGetFolderPath
    00039 #endif
    00040 #define SHGetFolderPath OTTDSHGetFolderPath
    00041
    00042 HRESULT OTTDSHGetFolderPath(HWND, int, HANDLE, DWORD, LPTSTR);
    00043
    00044 #if defined(__MINGW32__)
    00045 #define SHGFP_TYPE_CURRENT 0
    00046 #endif /* __MINGW32__ */
    00047
    00048 #endif /* WIN32_H */