Update windows-rs

This commit is contained in:
Your Name
2025-02-16 12:15:16 -05:00
parent 989c5c05a5
commit 16f5f49c99
8 changed files with 98 additions and 82 deletions

View File

@@ -4,12 +4,11 @@ version = "0.2.0"
edition = "2021"
[dependencies]
windows-core = "0.58.0"
windows-core = "0.59.0"
[dependencies.windows]
version = "0.58.0"
version = "0.59.0"
features = [
"implement",
"Win32_Media_Audio",
"Win32_UI_Shell_PropertiesSystem",
"Data_Xml_Dom",

View File

@@ -1,4 +1,6 @@
use windows::Win32::Media::Audio::{IMMNotificationClient, IMMNotificationClient_Impl, DEVICE_STATE};
use windows::Win32::Media::Audio::{
IMMNotificationClient, IMMNotificationClient_Impl, DEVICE_STATE,
};
pub trait DeviceNotificationObserver {
fn add_device(&self, device_id: &windows::core::PCWSTR);
}
@@ -37,9 +39,9 @@ impl IMMNotificationClient_Impl for DeviceNotificationClient_Impl {
fn OnPropertyValueChanged(
&self,
_pwstrdeviceid: &windows::core::PCWSTR,
_key: &windows::Win32::UI::Shell::PropertiesSystem::PROPERTYKEY,
) -> windows::core::Result<()> {
_pwstrdeviceid: &windows_core::PCWSTR,
_key: &windows::Win32::Foundation::PROPERTYKEY,
) -> windows_core::Result<()> {
Ok(())
}
}

View File

@@ -15,7 +15,7 @@ pub trait SessionObserver {
}
impl IAudioSessionNotification_Impl for SessionNotification_Impl {
fn OnSessionCreated(&self,newsession:Option<&IAudioSessionControl>) -> windows::core::Result<()> {
fn OnSessionCreated(&self,newsession:windows_core::Ref<'_, IAudioSessionControl>) -> windows::core::Result<()> {
let ses: IAudioSessionControl2 = newsession.as_ref().unwrap().cast().unwrap();
self.observer.add_session(ses);
Ok(())

View File

@@ -4,7 +4,7 @@ use std::{
};
use windows::Win32::{
Foundation::{HINSTANCE, HWND, LPARAM, WPARAM},
Foundation::{HWND, LPARAM, WPARAM},
System::Threading::GetCurrentThreadId,
UI::{
Accessibility::{SetWinEventHook, UnhookWinEvent, HWINEVENTHOOK},
@@ -53,7 +53,7 @@ pub fn await_win_change_events(callback: WinCallback) {
let fg_event = SetWinEventHook(
EVENT_SYSTEM_FOREGROUND,
EVENT_SYSTEM_FOREGROUND,
HINSTANCE::default(),
None,
Some(win_event_proc),
0,
0,
@@ -62,7 +62,7 @@ pub fn await_win_change_events(callback: WinCallback) {
let min_event = SetWinEventHook(
EVENT_SYSTEM_MINIMIZEEND,
EVENT_SYSTEM_MINIMIZEEND,
HINSTANCE::default(),
None,
Some(win_event_proc),
0,
0,
@@ -70,7 +70,7 @@ pub fn await_win_change_events(callback: WinCallback) {
);
let mut msg: MSG = MSG::default();
while GetMessageW(&mut msg, HWND::default(), 0, 0).0 > 0 {
while GetMessageW(&mut msg, None, 0, 0).0 > 0 {
TranslateMessage(&msg).unwrap();
DispatchMessageW(&msg);
}