windows (0.100.0+paring.1)

Published 2026-10-14 03:21:30 +09:00 by paring

Installation

[registries.forgejo]
index = "sparse+" # Sparse index
# index = "" # Git

[net]
git-fetch-with-cli = true
cargo add windows@0.100.0+paring.1 --registry forgejo

About this package

Rust for Windows

windows

The windows crate provides Rust bindings for Win32, COM, and WinRT APIs generated from Windows metadata.

Start by adding the following to your Cargo.toml file:

[dependencies.windows]
version = "0.100"
features = [
    "Data_Xml_Dom",
    "handleapi",
    "synchapi",
    "winuser",
]

Make use of any Windows APIs as needed:

use windows::{core::*, Data::Xml::Dom::*, Win32::*};

fn main() -> Result<()> {
    let doc = XmlDocument::new()?;
    doc.LoadXml(h!("<html>hello world</html>"))?;

    let root = doc.DocumentElement()?;
    assert!(root.NodeName()? == "html");
    assert!(root.InnerText()? == "hello world");

    unsafe {
        let event = CreateEventW(None, true, false, None);
        if event.is_null() {
            return Err(Error::from_thread());
        }
        SetEvent(event).ok()?;
        WaitForSingleObject(event, 0);
        CloseHandle(event).ok()?;

        MessageBoxA(None, s!("Ansi"), s!("Caption"), MB_OK as u32);
        MessageBoxW(None, w!("Wide"), w!("Caption"), MB_OK as u32);
    }

    Ok(())
}

Dependencies

ID Version
windows-collections ^0.100.0
windows-core ^0.100.0
windows-future ^0.100.0
windows-numerics ^0.100.0
windows-reference ^0.100.0
windows-time ^0.100.0
Details
Cargo
2026-10-14 03:21:30 +09:00
22
2026-11-15 19:56:41 +09:00
MIT OR Apache-2.0
6.8 MiB
Assets (1)
Versions (1) View all
0.100.0+paring.1 2026-10-14