Skip to content

Instantly share code, notes, and snippets.

@kennykerr
Created February 27, 2024 18:57
Show Gist options
  • Save kennykerr/d4ccc279f767e23f55a7dafff8e81598 to your computer and use it in GitHub Desktop.
Save kennykerr/d4ccc279f767e23f55a7dafff8e81598 to your computer and use it in GitHub Desktop.
use windows::core::*;
use windows::Win32::System::Com::*;
use windows::Win32::UI::Accessibility::*;
use windows::Win32::UI::WindowsAndMessaging::*;
fn main() -> Result<()> {
unsafe {
let mut acc: Option<IAccessible> = None;
AccessibleObjectFromWindow(
GetDesktopWindow(),
OBJID_WINDOW.0 as u32,
&IAccessible::IID,
&mut acc as *mut _ as _,
)?;
let acc = acc.unwrap();
let mut children = [VARIANT::default()];
let mut retrieved = 0;
AccessibleChildren(&acc, 0, &mut children, &mut retrieved)?;
let child = IDispatch::try_from(&children[0])?;
assert_eq!(child.GetTypeInfoCount()?, 1);
Ok(())
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment