# win32.h File Reference

declarations of functions for MS windows systems More...

`#include <windows.h>`

Go to the source code of this file.

## Defines
#define | MB_TO_WIDE(str) (str)
#define | MB_TO_WIDE_BUFFER(str, buffer, buflen) (str)
#define | WIDE_TO_MB(str) (str)
#define | WIDE_TO_MB_BUFFER(str, buffer, buflen) (str)
#define | SHGetFolderPath OTTDSHGetFolderPath
## Typedefs
typedef void(* | Function )(int)
## Functions
bool | MyShowCursor (bool show)
bool | LoadLibraryList (Function proc[], const char *dll)
| Helper function needed by dynamically loading libraries XXX: Hurray for MS only having an ANSI GetProcAddress function on normal windows and no Wide version except for in Windows Mobile/CE.
char * | convert_from_fs (const wchar_t *name, char *utf8_buf, size_t buflen)
| Convert to OpenTTD's encoding from that of the environment in UNICODE.
wchar_t * | convert_to_fs (const char *name, wchar_t *utf16_buf, size_t buflen)
| Convert from OpenTTD's encoding to that of the environment in UNICODE.
HRESULT | OTTDSHGetFolderPath (HWND, int, HANDLE, DWORD, LPTSTR)
| Our very own SHGetFolderPath function for support of windows operating systems that don't have this function (eg Win9x, etc.
## Variables
uint | _codepage

## Detailed Description

declarations of functions for MS windows systems

Definition in file win32.h.

## Function Documentation

char* convert_from_fs | ( | const wchar_t * | name,
|  | char * | utf8_buf,
|  | size_t | buflen |
| ) |  |  |

Convert to OpenTTD's encoding from that of the environment in UNICODE.

OpenTTD encoding is UTF8, local is wide

Parameters:

  | name | pointer to a valid string that will be converted
  | utf8_buf | pointer to a valid buffer that will receive the converted string
  | buflen | length in characters of the receiving buffer

Returns:
  pointer to utf8_buf. If conversion fails the string is of zero-length

Definition at line 1271 of file win32.cpp.

Referenced by FS2OTTD(), and InsertTextBufferClipboard().

wchar_t* convert_to_fs | ( | const char * | name,
|  | wchar_t * | utf16_buf,
|  | size_t | buflen |
| ) |  |  |

Convert from OpenTTD's encoding to that of the environment in UNICODE.

OpenTTD encoding is UTF8, local is wide

Parameters:

  | name | pointer to a valid string that will be converted
  | utf16_buf | pointer to a valid wide-char buffer that will receive the converted string
  | buflen | length in wide characters of the receiving buffer

Returns:
  pointer to utf16_buf. If conversion fails the string is of zero-length

Definition at line 1290 of file win32.cpp.

Referenced by OTTD2FS().

HRESULT OTTDSHGetFolderPath | ( | HWND | hwnd,
|  | int | csidl,
|  | HANDLE | hToken,
|  | DWORD | dwFlags,
|  | LPTSTR | pszPath |
| ) |  |  |

Our very own SHGetFolderPath function for support of windows operating systems that don't have this function (eg Win9x, etc.

). We try using the native function, and if that doesn't exist we will try a more crude approach of environment variables and hope for the best

Definition at line 1305 of file win32.cpp.

References LoadLibraryList().