OpenTTD: src/os/windows/win32.h File Reference

OpenTTD

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- File List
- Globals

Macros | Typedefs | Functions
win32.h File Reference

declarations of functions for MS windows systems More...

`#include <windows.h>`

Go to the source code of this file.

## Macros
#define | MB_TO_WIDE(str) OTTD2FS(str)
#define | WIDE_TO_MB(str) FS2OTTD(str)

## Typedefs
typedef void(* | Function )(int)

## Functions
bool | MyShowCursor (bool show, bool toggle=false)
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 TCHAR *name, char *utf8_buf, size_t buflen)
| Convert to OpenTTD's encoding from that of the environment in UNICODE.
TCHAR * | convert_to_fs (const char *name, TCHAR *utf16_buf, size_t buflen, bool console_cp=false)
| 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.).

## Detailed Description

declarations of functions for MS windows systems

Definition in file win32.h.

## Function Documentation

char* convert_from_fs | ( | const TCHAR * | 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 636 of file win32.cpp.

References AllocaM.

Referenced by FS2OTTD(), and HandleIMEComposition().

TCHAR* convert_to_fs | ( | const char * | name,
|  | TCHAR * | system_buf,
|  | size_t | buflen,
|  | bool | console_cp
| ) |  |

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
  console_cp | convert to the console encoding instead of the normal system encoding.

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

Definition at line 670 of file win32.cpp.

References AllocaM.

Referenced by HelpDialogFunc(), and 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 698 of file win32.cpp.

References DEBUG, and LoadLibraryList().