os.windows
- Windows support ¶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 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.
• Windows dialogs: | ||
• Windows console API: |
Currenly we only have MessageBox API.
{os.windows
}
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.
MB_ABORTRETRYIGNORE
,
MB_CANCELTRYCONTINUE
,
MB_HELP
,
MB_OK
(default),
MB_OKCANCEL
,
MB_RETRYCANCEL
,
MB_YESNO
,
MB_YESNOCANCEL
Default is no icon. Possible values:
MB_ICONEXCLAMATION
,
MB_ICONWARNING
,
MB_ICONINFORMATION
,
MB_ICONASTERISK
,
MB_ICONQUESTION
,
MB_ICONSTOP
,
MB_ICONERROR
,
MB_ICONHAND
MB_DEFBUTTON1
(default),
MB_DEFBUTTON2
,
MB_DEFBUTTON3
,
MB_DEFBUTTON4
MB_APPLMODAL
(default),
MB_SYSTEMMODAL
,
MB_TASKMODAL
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
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.
[Windows]
{os.windows
}
Calls AllocConsole
and FreeConsole
, respectively.
[Windows]
{os.windows
}
Calls GenerateConsoleCtrlEvent
. For event argument,
the constants CTRL_C_EVENT
and CTRL_BREAK_EVENT
are available.
[Windows]
{os.windows
}
Constants to be used for event argument of
sys-generate-console
above.
[Windows]
{os.windows
}
Call GetConsoleCP
, GetConsoleOutputCP
,
SetConsoleCP
, and SetConsoleOutputCP
, respectively.
Setter procedures returns an undefined value.
[Windows]
{os.windows
}
Call GetConsoleCursorInfo
and SetConsoleCursorInfo
,
respectively. Handle is a handle to the console screen buffer.
The getter returns two values, size (the integer
percentage of the character cell that is filled by the cursor,
between 1 and 100), and a boolean visible flag.
The setter takes a handle to the console screen buffer,
integer size percentage, and boolean visible flag. It returns
an undefined value.
[Windows]
{os.windows
}
Calls SetConsoleCursorPosition
.
Handle is a handle to the console screen buffer.
X and y are cursor coordinates in character position,
where (0, 0) is the upper-left corner of the console screen buffer.
It returns an undefined value.
To get the current cursor position, you can use
sys-get-console-screen-buffer-info
.
[Windows]
{os.windows
}
[Windows]
{os.windows
}
[Windows]
{os.windows
}
[Windows]
{os.windows
}
[Windows]
{os.windows
}
[Windows]
{os.windows
}
<win:console-screen-buffer-info>
: size.x ¶<win:console-screen-buffer-info>
: size.y ¶<win:console-screen-buffer-info>
: cursor-position.x ¶<win:console-screen-buffer-info>
: cursor-position.y ¶<win:console-screen-buffer-info>
: attributes ¶[Windows]
{os.windows
}
[Windows]
{os.windows
}
[Windows]
{os.windows
}
[Windows]
{os.windows
}
[Windows]
{os.windows
}
<win:input-record>
: event-type ¶<win:input-record>
: key.down ¶<win:input-record>
: key.repeat-count ¶<win:input-record>
: key.virtual-key-code ¶<win:input-record>
: key.virtual-scan-code ¶<win:input-record>
: key.unicode-char ¶<win:input-record>
: key.ascii-char ¶<win:input-record>
: key.control-key-state ¶<win:input-record>
: mouse.x ¶<win:input-record>
: mouse.y ¶<win:input-record>
: mouse.button-state ¶<win:input-record>
: mouse.control-key-state ¶<win:input-record>
: mouse.event-flags ¶<win:input-record>
: window-buffer-size.x ¶<win:input-record>
: window-buffer-size.y ¶<win:input-record>
: focus.set-focus ¶[Windows]
{os.windows
}
[Windows]
{os.windows
}
[Windows]
{os.windows
}
[Windows]
{os.windows
}
[Windows]
{os.windows
}
[Windows]
{os.windows
}
[Windows]
{os.windows
}
[Windows]
{os.windows
}
[Windows]
{os.windows
}
[Windows]
{os.windows
}
[Windows]
{os.windows
}
[Windows]
{os.windows
}
[Windows]
{os.windows
}
[Windows]
{os.windows
}
[Windows]
{os.windows
}
[Windows]
{os.windows
}