IlluLang Logo

IlluLang

<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 -> true on Windows builds, false otherwise
  • platform -> "windows" on Windows builds, "non-windows" otherwise
  • version -> internal module version string

System/Process Helpers

  • getcwd() -> string
  • chdir(path: string) -> bool
  • env_get(name: string) -> string
  • env_set(name: string, value: string) -> bool
  • env_list() -> dict
  • system_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 (> 0 on success, 0 on 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 MessageBox style flags via style.

Message loop

  • pump() -> int : Processes currently pending messages once. : Returns processed count, or -1 when 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 include type, target, wparam, lparam, and optional callback. : For click events with a registered callback label, poll_event also invokes that runtime function directly and may include: : callback_invoked (bool) and callback_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