[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

11.17 os.windows - Windows support

Module: os.windows

This module is only available on Windows-native Gauche, and provides Windows-specific procedures. You can check gauche.os.windows feature with cond-expand macro (See section srfi-0 - Feature conditional) to conditionalize windows-specific code.

 
(cond-expand
  [gauche.os.windows
   (use os.windows)
   ... Windows-specific code ...]
  [else
   ... Unix code ...])

Currently there aren’t enough procedures provided here, but eventually we want to support simple scripting on Windows.

Unless otherwise noted, when Windows API returns an error value, a <system-error> condition is thrown.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

11.17.1 Windows dialogs

Currenly we only have MessageBox API.

Function: sys-message-box window message :optional caption flags

Calls Windows MessageBox API. The window argument should be a handle for a window, or #f; at the moment we don’t provide any API that retrieves window handles, so you should always pass #f here. The message argument takes a string for the content of the message box. Optional caption argument takes a string to be used in the window title.

The flags argument is an integer; it should be logior of values from one or more of the following groups. See the Windows reference manual for the details.

Buttons

MB_ABORTRETRYIGNORE, MB_CANCELTRYCONTINUE, MB_HELP, MB_OK (default), MB_OKCANCEL, MB_RETRYCANCEL, MB_YESNO, MB_YESNOCANCEL

Icon

Default is no icon. Possible values: MB_ICONEXCLAMATION, MB_ICONWARNING, MB_ICONINFORMATION, MB_ICONASTERISK, MB_ICONQUESTION, MB_ICONSTOP, MB_ICONERROR, MB_ICONHAND

Default button

MB_DEFBUTTON1 (default), MB_DEFBUTTON2, MB_DEFBUTTON3, MB_DEFBUTTON4

Modality

MB_APPLMODAL (default), MB_SYSTEMMODAL, MB_TASKMODAL

Other options

MB_DEFAULT_DESKTOP_ONLY, MB_RIGHT, MB_RTLREADING, MB_SETFOREGROUND, MB_TOPMOST, MB_SERVICE_NOTIFICATION

Return value is one of the following integer constants, indicating which button is pressed: IDABORT, IDCANCEL, IDCONTINUE, IDIGNORE, IDNO, IDOK, IDRETRY, IDTRYAGAIN, or IDYES


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

11.17.2 Windows console API

Most of these procedures corresponds to Windows Console API one-to-one. See the Windows reference for the detail description of what each API does.

Attaching and detaching

Function: sys-alloc-console
Function: sys-free-console

[Windows] Calls AllocConsole and FreeConsole, respectively.

Function: sys-generate-console-ctrl-event event pgid

[Windows]

Constant: CTRL_C_EVENT
Constant: CTRL_BREAK_EVENT

[Windows]

Console codepage

Function: sys-get-console-cp
Function: sys-get-console-output-cp
Function: sys-set-console-cp codepage
Function: sys-set-console-output-cp codepage

[Windows]

Function: sys-get-console-cursor-info handle
Function: sys-set-console-cursor-info handle size visible

[Windows]

Function: sys-set-console-cursor-position handle x y

[Windows]

Console mode

Function: sys-get-console-mode handle
Function: sys-set-console-mode handle mode

[Windows]

Constant: ENABLE_LINE_INPUT
Constant: ENABLE_ECHO_INPUT
Constant: ENABLE_PROCESSED_INPUT
Constant: ENABLE_WINDOW_INPUT
Constant: ENABLE_MOUSE_INPUT
Constant: ENABLE_PROCESSED_OUTPUT
Constant: ENABLE_WRAP_AT_EOL_OUTPUT

[Windows]

Screen buffer

Function: sys-create-console-screen-buffer desired-access share-mode inheritable

[Windows]

Constant: GENERIC_READ
Constant: GENERIC_WRITE

[Windows]

Constant: FILE_SHARE_READ
Constant: FILE_SHARE_WRITE

[Windows]

Function: sys-set-console-active-screen-buffer handle

[Windows]

Function: sys-scroll-console-screen-buffer handle scroll-rectangle clip-rectangle x y fill

[Windows]

Class: <win:console-screen-buffer-info>

[Windows]

Instance Variable of <win:console-screen-buffer-info>: size.x
Instance Variable of <win:console-screen-buffer-info>: size.y
Instance Variable of <win:console-screen-buffer-info>: cursor-position.x
Instance Variable of <win:console-screen-buffer-info>: cursor-position.y
Instance Variable of <win:console-screen-buffer-info>: attributes
Instance Variable of <win:console-screen-buffer-info>: window.left
Instance Variable of <win:console-screen-buffer-info>: window.top
Instance Variable of <win:console-screen-buffer-info>: window.right
Instance Variable of <win:console-screen-buffer-info>: window.bottom
Instance Variable of <win:console-screen-buffer-info>: maximum-window-size.x
Instance Variable of <win:console-screen-buffer-info>: maximum-window-size.y
Constant: FOREGROUND_BLUE
Constant: FOREGROUND_GREEN
Constant: FOREGROUND_RED
Constant: FOREGROUND_INTENSITY
Constant: BACKGROUND_BLUE
Constant: BACKGROUND_GREEN
Constant: BACKGROUND_RED
Constant: BACKGROUND_INTENSITY

[Windows]

Function: sys-get-console-screen-buffer-info handle

[Windows]

Function: sys-get-largest-console-window-size handle

[Windows]

Function: sys-set-screen-buffer-size handle x y

[Windows]

Console input/output

Class: <win:input-record>

[Windows]

Instance Variable of <win:input-record>: event-type
Instance Variable of <win:input-record>: key.down
Instance Variable of <win:input-record>: key.repeat-count
Instance Variable of <win:input-record>: key.virtual-key-code
Instance Variable of <win:input-record>: key.unicode-char
Instance Variable of <win:input-record>: key.ascii-char
Instance Variable of <win:input-record>: key.control-key-state
Instance Variable of <win:input-record>: mouse.x
Instance Variable of <win:input-record>: mouse.y
Instance Variable of <win:input-record>: mouse.button-state
Instance Variable of <win:input-record>: mouse.event-flags
Instance Variable of <win:input-record>: window-buffer-size.x
Instance Variable of <win:input-record>: window-buffer-size.y
Instance Variable of <win:input-record>: menu.command-id
Instance Variable of <win:input-record>: focus.set-focus
Function: sys-get-number-of-console-input-events handle

[Windows]

Function: sys-get-number-of-console-mouse-buttons

[Windows]

Function: sys-peek-console-input handle
Function: sys-read-console-input handle

[Windows]

Function: sys-read-console handle buf

[Windows]

Function: sys-read-console-output handle buf w h x y region

[Windows]

Function: sys-read-console-output-attribute handle buf x y

[Windows]

Function: sys-read-console-output-character handle len x y

[Windows]

Function: sys-set-console-text-attribute handle attr

[Windows]

Function: sys-set-console-window-info handle absolute window

[Windows]

Function: sys-write-console handle string

[Windows]

Function: sys-write-console-output-character handle string x y

[Windows]

Function: sys-get-console-title

[Windows]

Standard handles

Function: sys-get-std-handle which
Function: sys-set-std-handle which handle

[Windows]

Constant: STD_INPUT_HANDLE
Constant: STD_OUTPUT_HANDLE
Constant: STD_ERROR_HANDLE

[ < ] [ > ]   [ << ] [ Up ] [ >> ]

This document was generated by Shiro Kawai on May 28, 2012 using texi2html 1.82.