System.Win32.Utils

Win32-2.10.0.0: A binding to Windows Win32 API.

Copyright | 2009 Balazs Komuves 2013 shelarcy
License | BSD-style
Maintainer | shelarcy@gmail.com
Stability | Provisional
Portability | Non-portable (Win32 API)
Safe Haskell | Safe-Inferred
Language | Haskell2010

System.Win32.Utils

Contents

- Maybe values
- Format picture translation

Description

Utilities for calling Win32 API

Synopsis

- try :: String -> (LPTSTR -> UINT -> IO UINT) -> UINT -> IO String
- tryWithoutNull :: String -> (LPTSTR -> UINT -> IO UINT) -> UINT -> IO String
- trySized :: String -> (LPTSTR -> CInt -> IO CInt) -> IO String
- try' :: Storable a => String -> (Ptr a -> PDWORD -> IO BOOL) -> DWORD -> IO [a]
- maybePtr :: Maybe (Ptr a) -> Ptr a
- ptrToMaybe :: Ptr a -> Maybe (Ptr a)
- maybeNum :: Num a => Maybe a -> a
- numToMaybe :: (Eq a, Num a) => a -> Maybe a
- peekMaybe :: Storable a => Ptr a -> IO (Maybe a)
- withMaybe :: Storable a => Maybe a -> (Ptr a -> IO b) -> IO b
- fromDateFormatPicture :: String -> Maybe String
- fromTimeFormatPicture :: String -> Maybe String

# Documentation

try :: String -> (LPTSTR -> UINT -> IO UINT) -> UINT -> IO String Source #

Support for API calls that are passed a fixed-size buffer and tell you via the return value if the buffer was too small. In that case, we extend the buffer size and try again.

tryWithoutNull :: String -> (LPTSTR -> UINT -> IO UINT) -> UINT -> IO String Source #

trySized :: String -> (LPTSTR -> CInt -> IO CInt) -> IO String Source #

Support for API calls that return the required size, in characters including a null character, of the buffer when passed a buffer size of zero.

try' :: Storable a => String -> (Ptr a -> PDWORD -> IO BOOL) -> DWORD -> IO [a] Source #

# Maybe values

maybePtr :: Maybe (Ptr a) -> Ptr a Source #

ptrToMaybe :: Ptr a -> Maybe (Ptr a) Source #

maybeNum :: Num a => Maybe a -> a Source #

numToMaybe :: (Eq a, Num a) => a -> Maybe a Source #

peekMaybe :: Storable a => Ptr a -> IO (Maybe a) Source #

See also: `maybePeek` function.

withMaybe :: Storable a => Maybe a -> (Ptr a -> IO b) -> IO b Source #

See also: `maybeWith` function.

# Format picture translation

fromDateFormatPicture :: String -> Maybe String Source #

Translate from a Windows API day, month, year, and era format picture to the closest corresponding format string used by `formatTime`.

fromTimeFormatPicture :: String -> Maybe String Source #

Translate from a Windows API hours, minute, and second format picture to the closest corresponding format string used by `formatTime`.