System.Win32.WindowsString.Console

Win32-2.14.0.0: A binding to Windows Win32 API.

Copyright | (c) University of Glasgow 2023
License | BSD-style (see the file LICENSE)
Maintainer | Esa Ilari Vuokko <ei@vuokko.info>
Stability | provisional
Portability | portable
Safe Haskell | None
Language | Haskell2010

System.Win32.WindowsString.Console

Contents

- Console mode
- Console code pages
- Ctrl events
- Command line
- Screen buffer

Description

A collection of FFI declarations for interfacing with Win32 Console API (WindowsString variant)

Synopsis

- getConsoleMode :: HANDLE -> IO DWORD
- setConsoleMode :: HANDLE -> DWORD -> IO ()
- eNABLE_ECHO_INPUT :: DWORD
- eNABLE_EXTENDED_FLAGS :: DWORD
- eNABLE_INSERT_MODE :: DWORD
- eNABLE_LINE_INPUT :: DWORD
- eNABLE_MOUSE_INPUT :: DWORD
- eNABLE_PROCESSED_INPUT :: DWORD
- eNABLE_QUICK_EDIT_MODE :: DWORD
- eNABLE_WINDOW_INPUT :: DWORD
- eNABLE_VIRTUAL_TERMINAL_INPUT :: DWORD
- eNABLE_PROCESSED_OUTPUT :: DWORD
- eNABLE_WRAP_AT_EOL_OUTPUT :: DWORD
- eNABLE_VIRTUAL_TERMINAL_PROCESSING :: DWORD
- dISABLE_NEWLINE_AUTO_RETURN :: DWORD
- eNABLE_LVB_GRID_WORLDWIDE :: DWORD
- getConsoleCP :: IO UINT
- setConsoleCP :: UINT -> IO ()
- getConsoleOutputCP :: IO UINT
- setConsoleOutputCP :: UINT -> IO ()
- type CtrlEvent = DWORD
- cTRL_C_EVENT :: CtrlEvent
- cTRL_BREAK_EVENT :: CtrlEvent
- generateConsoleCtrlEvent :: CtrlEvent -> DWORD -> IO ()
- commandLineToArgv :: WindowsString -> IO [WindowsString]
- getCommandLineW :: IO LPWSTR
- getArgs :: IO [WindowsString]
- data CONSOLE_SCREEN_BUFFER_INFO = CONSOLE_SCREEN_BUFFER_INFO {
  - dwSize :: COORD
  - dwCursorPosition :: COORD
  - wAttributes :: WORD
  - srWindow :: SMALL_RECT
  - dwMaximumWindowSize :: COORD
  }
- data CONSOLE_SCREEN_BUFFER_INFOEX = CONSOLE_SCREEN_BUFFER_INFOEX {
  - dwSizeEx :: COORD
  - dwCursorPositionEx :: COORD
  - wAttributesEx :: WORD
  - srWindowEx :: SMALL_RECT
  - dwMaximumWindowSizeEx :: COORD
  - wPopupAttributes :: WORD
  - bFullscreenSupported :: BOOL
  - colorTable :: [COLORREF]
  }
- data COORD = COORD {
  - xPos :: SHORT
  - yPos :: SHORT
  }
- data SMALL_RECT = SMALL_RECT {
  - leftPos :: SHORT
  - topPos :: SHORT
  - rightPos :: SHORT
  - bottomPos :: SHORT
  }
- type COLORREF = Word32
- getConsoleScreenBufferInfo :: HANDLE -> IO CONSOLE_SCREEN_BUFFER_INFO
- getCurrentConsoleScreenBufferInfo :: IO CONSOLE_SCREEN_BUFFER_INFO
- getConsoleScreenBufferInfoEx :: HANDLE -> IO CONSOLE_SCREEN_BUFFER_INFOEX
- getCurrentConsoleScreenBufferInfoEx :: IO CONSOLE_SCREEN_BUFFER_INFOEX

# Console mode

getConsoleMode :: HANDLE -> IO DWORD Source #

setConsoleMode :: HANDLE -> DWORD -> IO () Source #

eNABLE_ECHO_INPUT :: DWORD Source #

eNABLE_EXTENDED_FLAGS :: DWORD Source #

eNABLE_INSERT_MODE :: DWORD Source #

eNABLE_LINE_INPUT :: DWORD Source #

eNABLE_MOUSE_INPUT :: DWORD Source #

eNABLE_PROCESSED_INPUT :: DWORD Source #

eNABLE_QUICK_EDIT_MODE :: DWORD Source #

eNABLE_WINDOW_INPUT :: DWORD Source #

eNABLE_VIRTUAL_TERMINAL_INPUT :: DWORD Source #

eNABLE_PROCESSED_OUTPUT :: DWORD Source #

eNABLE_WRAP_AT_EOL_OUTPUT :: DWORD Source #

eNABLE_VIRTUAL_TERMINAL_PROCESSING :: DWORD Source #

dISABLE_NEWLINE_AUTO_RETURN :: DWORD Source #

eNABLE_LVB_GRID_WORLDWIDE :: DWORD Source #

# Console code pages

getConsoleCP :: IO UINT Source #

setConsoleCP :: UINT -> IO () Source #

getConsoleOutputCP :: IO UINT Source #

setConsoleOutputCP :: UINT -> IO () Source #

# Ctrl events

type CtrlEvent = DWORD Source #

cTRL_C_EVENT :: CtrlEvent Source #

cTRL_BREAK_EVENT :: CtrlEvent Source #

generateConsoleCtrlEvent :: CtrlEvent -> DWORD -> IO () Source #

# Command line

commandLineToArgv :: WindowsString -> IO [WindowsString] Source #

This function can be used to parse command line arguments and return the split up arguments as elements in a list.

getCommandLineW :: IO LPWSTR Source #

getArgs :: IO [WindowsString] Source #

Based on `GetCommandLineW`. This behaves slightly different than `getArgs`. See the online documentation: https://learn.microsoft.com/en-us/windows/win32/api/processenv/nf-processenv-getcommandlinew

# Screen buffer

data CONSOLE_SCREEN_BUFFER_INFO Source #

Constructors

CONSOLE_SCREEN_BUFFER_INFO |
Fields dwSize :: COORD dwCursorPosition :: COORD wAttributes :: WORD srWindow :: SMALL_RECT dwMaximumWindowSize :: COORD

#### Instances

Instances details

Storable CONSOLE_SCREEN_BUFFER_INFO Source # |
Instance details Defined in System.Win32.Console.Internal Methods sizeOf :: CONSOLE_SCREEN_BUFFER_INFO -> Int # alignment :: CONSOLE_SCREEN_BUFFER_INFO -> Int # peekElemOff :: Ptr CONSOLE_SCREEN_BUFFER_INFO -> Int -> IO CONSOLE_SCREEN_BUFFER_INFO # pokeElemOff :: Ptr CONSOLE_SCREEN_BUFFER_INFO -> Int -> CONSOLE_SCREEN_BUFFER_INFO -> IO () # peekByteOff :: Ptr b -> Int -> IO CONSOLE_SCREEN_BUFFER_INFO # pokeByteOff :: Ptr b -> Int -> CONSOLE_SCREEN_BUFFER_INFO -> IO () # peek :: Ptr CONSOLE_SCREEN_BUFFER_INFO -> IO CONSOLE_SCREEN_BUFFER_INFO # poke :: Ptr CONSOLE_SCREEN_BUFFER_INFO -> CONSOLE_SCREEN_BUFFER_INFO -> IO () #
Show CONSOLE_SCREEN_BUFFER_INFO Source # |
Instance details Defined in System.Win32.Console.Internal Methods showsPrec :: Int -> CONSOLE_SCREEN_BUFFER_INFO -> ShowS # show :: CONSOLE_SCREEN_BUFFER_INFO -> String # showList :: [CONSOLE_SCREEN_BUFFER_INFO] -> ShowS #
Eq CONSOLE_SCREEN_BUFFER_INFO Source # |
Instance details Defined in System.Win32.Console.Internal Methods (==) :: CONSOLE_SCREEN_BUFFER_INFO -> CONSOLE_SCREEN_BUFFER_INFO -> Bool # (/=) :: CONSOLE_SCREEN_BUFFER_INFO -> CONSOLE_SCREEN_BUFFER_INFO -> Bool #

data CONSOLE_SCREEN_BUFFER_INFOEX Source #

Constructors

CONSOLE_SCREEN_BUFFER_INFOEX |
Fields dwSizeEx :: COORD dwCursorPositionEx :: COORD wAttributesEx :: WORD srWindowEx :: SMALL_RECT dwMaximumWindowSizeEx :: COORD wPopupAttributes :: WORD bFullscreenSupported :: BOOL colorTable :: [COLORREF] Only the first 16 `COLORREF` values passed to the Windows Console API. If fewer than 16 values, the remainder are padded with `0` when passed to the API.

#### Instances

Instances details

Storable CONSOLE_SCREEN_BUFFER_INFOEX Source # |
Instance details Defined in System.Win32.Console.Internal Methods sizeOf :: CONSOLE_SCREEN_BUFFER_INFOEX -> Int # alignment :: CONSOLE_SCREEN_BUFFER_INFOEX -> Int # peekElemOff :: Ptr CONSOLE_SCREEN_BUFFER_INFOEX -> Int -> IO CONSOLE_SCREEN_BUFFER_INFOEX # pokeElemOff :: Ptr CONSOLE_SCREEN_BUFFER_INFOEX -> Int -> CONSOLE_SCREEN_BUFFER_INFOEX -> IO () # peekByteOff :: Ptr b -> Int -> IO CONSOLE_SCREEN_BUFFER_INFOEX # pokeByteOff :: Ptr b -> Int -> CONSOLE_SCREEN_BUFFER_INFOEX -> IO () # peek :: Ptr CONSOLE_SCREEN_BUFFER_INFOEX -> IO CONSOLE_SCREEN_BUFFER_INFOEX # poke :: Ptr CONSOLE_SCREEN_BUFFER_INFOEX -> CONSOLE_SCREEN_BUFFER_INFOEX -> IO () #
Show CONSOLE_SCREEN_BUFFER_INFOEX Source # |
Instance details Defined in System.Win32.Console.Internal Methods showsPrec :: Int -> CONSOLE_SCREEN_BUFFER_INFOEX -> ShowS # show :: CONSOLE_SCREEN_BUFFER_INFOEX -> String # showList :: [CONSOLE_SCREEN_BUFFER_INFOEX] -> ShowS #
Eq CONSOLE_SCREEN_BUFFER_INFOEX Source # |
Instance details Defined in System.Win32.Console.Internal Methods (==) :: CONSOLE_SCREEN_BUFFER_INFOEX -> CONSOLE_SCREEN_BUFFER_INFOEX -> Bool # (/=) :: CONSOLE_SCREEN_BUFFER_INFOEX -> CONSOLE_SCREEN_BUFFER_INFOEX -> Bool #

data COORD Source #

Constructors

COORD |
Fields xPos :: SHORT yPos :: SHORT

#### Instances

Instances details

Storable COORD Source # |
Instance details Defined in System.Win32.Console.Internal Methods sizeOf :: COORD -> Int # alignment :: COORD -> Int # peekElemOff :: Ptr COORD -> Int -> IO COORD # pokeElemOff :: Ptr COORD -> Int -> COORD -> IO () # peekByteOff :: Ptr b -> Int -> IO COORD # pokeByteOff :: Ptr b -> Int -> COORD -> IO () # peek :: Ptr COORD -> IO COORD # poke :: Ptr COORD -> COORD -> IO () #
Show COORD Source # |
Instance details Defined in System.Win32.Console.Internal Methods showsPrec :: Int -> COORD -> ShowS # show :: COORD -> String # showList :: [COORD] -> ShowS #
Eq COORD Source # |
Instance details Defined in System.Win32.Console.Internal Methods (==) :: COORD -> COORD -> Bool # (/=) :: COORD -> COORD -> Bool #

data SMALL_RECT Source #

Constructors

SMALL_RECT |
Fields leftPos :: SHORT topPos :: SHORT rightPos :: SHORT bottomPos :: SHORT

#### Instances

Instances details

Storable SMALL_RECT Source # |
Instance details Defined in System.Win32.Console.Internal Methods sizeOf :: SMALL_RECT -> Int # alignment :: SMALL_RECT -> Int # peekElemOff :: Ptr SMALL_RECT -> Int -> IO SMALL_RECT # pokeElemOff :: Ptr SMALL_RECT -> Int -> SMALL_RECT -> IO () # peekByteOff :: Ptr b -> Int -> IO SMALL_RECT # pokeByteOff :: Ptr b -> Int -> SMALL_RECT -> IO () # peek :: Ptr SMALL_RECT -> IO SMALL_RECT # poke :: Ptr SMALL_RECT -> SMALL_RECT -> IO () #
Show SMALL_RECT Source # |
Instance details Defined in System.Win32.Console.Internal Methods showsPrec :: Int -> SMALL_RECT -> ShowS # show :: SMALL_RECT -> String # showList :: [SMALL_RECT] -> ShowS #
Eq SMALL_RECT Source # |
Instance details Defined in System.Win32.Console.Internal Methods (==) :: SMALL_RECT -> SMALL_RECT -> Bool # (/=) :: SMALL_RECT -> SMALL_RECT -> Bool #

type COLORREF = Word32 Source #

getConsoleScreenBufferInfo :: HANDLE -> IO CONSOLE_SCREEN_BUFFER_INFO Source #

getCurrentConsoleScreenBufferInfo :: IO CONSOLE_SCREEN_BUFFER_INFO Source #

getConsoleScreenBufferInfoEx :: HANDLE -> IO CONSOLE_SCREEN_BUFFER_INFOEX Source #

getCurrentConsoleScreenBufferInfoEx :: IO CONSOLE_SCREEN_BUFFER_INFOEX Source #