Created
February 27, 2024 18:57
-
-
Save kennykerr/d4ccc279f767e23f55a7dafff8e81598 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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