<windows> Internal Library
The <windows> internal library provides Windows platform helpers and GUI primitives.
Import
import win "<windows>"
You can also import into global scope:
import "<windows>"
Module Metadata
name->"windows"available->trueon Windows builds,falseotherwiseplatform->"windows"on Windows builds,"non-windows"otherwiseversion-> internal module version string
System/Process Helpers
getcwd() -> stringchdir(path: string) -> boolenv_get(name: string) -> stringenv_set(name: string, value: string) -> boolenv_list() -> dictsystem_exec(cmd: string) -> string
GUI API
Availability
gui_available() -> bool
Returns whether Win32 GUI support is available in the current runtime build.
Window lifecycle
-
create_window(title: string, width: int, height: int) -> int: Creates a window and returns a handle (> 0on success,0on failure). -
show(handle: int) -> bool: Shows a created window. -
hide(handle: int) -> bool: Hides a created window. -
destroy(handle: int) -> bool: Destroys a created window.
Window manipulation
-
set_title(handle: int, title: string) -> bool: Updates the window title. -
set_size(handle: int, width: int, height: int) -> bool: Resizes the window. -
set_position(handle: int, x: int, y: int) -> bool: Moves the window. -
center(handle: int) -> bool: Centers the window on the primary display.
Dialog helper
message_box(text: string, title: string, style?: int) -> int
Shows a Win32 message box and returns the button result code.
- Default style is
MB_OK | MB_ICONINFORMATION. - You can pass Win32
MessageBoxstyle flags viastyle.
Message loop
-
pump() -> int: Processes currently pending messages once. : Returns processed count, or-1when quit message is seen. -
message_loop() -> int: Runs blocking message loop until quit and returns exit code. -
post_quit(code?: int) -> bool: Posts a quit message with optional exit code.
Event callback primitives
-
on_click(control_handle: int, callback_name: string) -> bool: Registers a callback label for button click events. -
poll_event() -> dict | none: Returns queued UI events (click,resize,close) with metadata. : Event dict can includetype,target,wparam,lparam, and optionalcallback. : Forclickevents with a registered callback label,poll_eventalso invokes that runtime function directly and may include: :callback_invoked(bool) andcallback_result(returned value).
Layout primitives
-
layout_vertical(parent_handle: int, padding?: int, spacing?: int) -> int: Arranges child controls in a vertical stack. Returns number of controls placed. -
layout_horizontal(parent_handle: int, padding?: int, spacing?: int) -> int: Arranges child controls in a horizontal stack. Returns number of controls placed.
Usage Patterns
Blocking UI app loop
import win "<windows>"
if win.gui_available() {
var h = win.create_window("IlluLang GUI", 640, 360)
if h != 0 {
win.center(h)
win.show(h)
var code = win.message_loop()
display("exit code: " + code)
}
}
Non-blocking pump loop
import win "<windows>"
var h = win.create_window("Pumped Window", 480, 280)
if h != 0 {
win.show(h)
while true {
var p = win.pump()
if p < 0 { break }
## app logic here
}
}
Message box
import win "<windows>"
var rc = win.message_box("Saved successfully", "IlluLang")
display(rc)
Current Scope and Limitations
Current GUI layer is intentionally minimal and handle-based.
Not yet included:
- advanced layout constraints (grid/flex/anchors)
- menus/toolbars/status bars
- DPI/theme helpers