Scaffolding for COM work

This commit is contained in:
Your Name
2022-06-12 16:01:40 -04:00
parent fb172f673e
commit 6c50e23b47
3 changed files with 60 additions and 0 deletions

View File

@@ -2,6 +2,7 @@ mod pid_to_exe;
use windows::Win32::{
Foundation::{HINSTANCE, HWND},
Media::Audio::{IMMNotificationClient, IMMNotificationClient_Impl},
UI::{
Accessibility::{SetWinEventHook, HWINEVENTHOOK},
WindowsAndMessaging::{
@@ -58,6 +59,45 @@ fn win_event_hook_loop() {
}
}
}
#[windows::core::implement(IMMNotificationClient)]
struct DeviceNotification;
impl IMMNotificationClient_Impl for DeviceNotification {
fn OnDeviceStateChanged(
&self,
pwstrdeviceid: &windows::core::PCWSTR,
dwnewstate: u32,
) -> windows::core::Result<()> {
Ok(())
}
fn OnDeviceAdded(&self, pwstrdeviceid: &windows::core::PCWSTR) -> windows::core::Result<()> {
Ok(())
}
fn OnDeviceRemoved(&self, pwstrdeviceid: &windows::core::PCWSTR) -> windows::core::Result<()> {
Ok(())
}
fn OnDefaultDeviceChanged(
&self,
flow: windows::Win32::Media::Audio::EDataFlow,
role: windows::Win32::Media::Audio::ERole,
pwstrdefaultdeviceid: &windows::core::PCWSTR,
) -> windows::core::Result<()> {
Ok(())
}
fn OnPropertyValueChanged(
&self,
pwstrdeviceid: &windows::core::PCWSTR,
key: &windows::Win32::UI::Shell::PropertiesSystem::PROPERTYKEY,
) -> windows::core::Result<()> {
Ok(())
}
}
fn main() {
win_event_hook_loop();
}