I'm working something where I need to discover an element through a walker, and then later interact with it by its RuntimeId. I may be using the API wrong, but the most obvious (to me) way crashes with (exit code: 0xc0000005, STATUS_ACCESS_VIOLATION).
In the below MVBR, for simplicity sake, I'm skipping the walker and just trying to find the root element a second time using the result of root.get_runtime_id().
use uiautomation::core::UIAutomation;
use uiautomation::types::{TreeScope, UIProperty};
use uiautomation::variants::*;
fn main() {
let automation = UIAutomation::new().unwrap();
let root = automation.get_root_element().unwrap();
let runtime_id = root.get_runtime_id().unwrap();
// exit code: 0xc0000005, STATUS_ACCESS_VIOLATION occurs on next line
let condition = automation
.create_property_condition(
UIProperty::RuntimeId,
Variant::from(Value::ArrayI4(runtime_id)),
None,
)
.expect("Failed to create condition");
let element = root
.find_first(TreeScope::Element, &condition)
.expect("Failed to find element");
eprintln!("{}", element.get_name().unwrap());
}
I'm working something where I need to discover an element through a walker, and then later interact with it by its
RuntimeId
. I may be using the API wrong, but the most obvious (to me) way crashes with(exit code: 0xc0000005, STATUS_ACCESS_VIOLATION)
.In the below MVBR, for simplicity sake, I'm skipping the walker and just trying to find the root element a second time using the result of
root.get_runtime_id()
.