Scaffolding for COM work
This commit is contained in:
40
src/main.rs
40
src/main.rs
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user