| Crates.io | win32-util |
| lib.rs | win32-util |
| version | 0.2.1-alpha.1 |
| created_at | 2025-09-21 04:31:22.308161+00 |
| updated_at | 2025-09-22 18:10:53.186438+00 |
| description | High-level idiomatic bindings for a few parts of the Win32 API |
| homepage | https://github.com/the0x539/win32-util-rs |
| repository | https://github.com/the0x539/win32-util-rs |
| max_upload_size | |
| id | 1848436 |
| size | 47,526 |
win32-utilWrappers for some assorted parts of the Win32 API that I find myself using, and wishing there were nicer-to-use bindings. Well, now there are. I think.
use windows::core::Result;
use win32_util::audio_outputs::{AudioDevice, EndpointRole, EndpointDataFlow, DeviceStateMask};
use win32_util::display_config::{self, set::Topology};
fn main() -> Result<()> {
// Audio output devices
let (flow, state) = (EndpointDataFlow::Render, DeviceStateMask::ACTIVE);
for device in AudioDevice::enumerate(flow, state)? {
let device = device?;
println!("{}", device.long_name()?);
if device.short_name()?.contains("Headphones") {
device.set_as_default(EndpointRole::Multimedia)?;
}
}
// Display config
display_config::set::from_database(Topology::Extend)?;
Ok(())
}