windows-core (0.100.0+paring.1)

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

Installation

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

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

About this package

Core type support for COM and Windows

windows-core

The windows-core crate provides COM and WinRT types, traits, and macros for the windows-* family of crates.

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

[dependencies.windows-core]
version = "0.100"

Use the core types as needed:

use windows_core::{h, Result, HRESULT, HSTRING};

// WinRT reference-counted strings.
let name: &HSTRING = h!("Windows.Foundation.Uri");
assert_eq!(name, &HSTRING::from("Windows.Foundation.Uri"));

// HRESULT-based results.
fn check(code: HRESULT) -> Result<()> {
    code.ok()
}

assert!(check(HRESULT(0)).is_ok());
assert!(check(HRESULT(-2147467259)).is_err());

create_instance activates an in-process COM class and returns a requested interface. The application must initialize the calling thread for COM before using it.

Use init_mta for apartment-agnostic code. UI threads that require a single-threaded apartment can hold the value returned by init_sta for the lifetime of their COM objects.

Dependencies

ID Version
windows-implement ^0.100.0
windows-interface ^0.100.0
windows-link ^0.100.0
windows-result ^0.100.0
windows-strings ^0.100.0
Details
Cargo
2026-10-14 03:21:29 +09:00
21
2026-11-15 19:56:41 +09:00
MIT OR Apache-2.0
46 KiB
Assets (1)
Versions (1) View all
0.100.0+paring.1 2026-10-14