diff --git a/platforms/windows/bindings/build.rs b/platforms/windows/bindings/build.rs index 25e9a4edd..68cefb9c5 100644 --- a/platforms/windows/bindings/build.rs +++ b/platforms/windows/bindings/build.rs @@ -9,6 +9,7 @@ fn main() { Foundation::*, Graphics::Gdi::ValidateRect, System::{ + Com::CoInitializeEx, LibraryLoader::GetModuleHandleA, OleAutomation::*, }, diff --git a/platforms/windows/examples/hello_world.rs b/platforms/windows/examples/hello_world.rs index a45a8e706..a38d2b566 100644 --- a/platforms/windows/examples/hello_world.rs +++ b/platforms/windows/examples/hello_world.rs @@ -4,8 +4,8 @@ use std::num::NonZeroU64; use accesskit_schema::{Node, NodeId, Role, StringEncoding, Tree, TreeId, TreeUpdate}; use accesskit_windows_bindings::Windows::Win32::{ - Foundation::*, Graphics::Gdi::ValidateRect, System::LibraryLoader::GetModuleHandleA, - UI::WindowsAndMessaging::*, + Foundation::*, Graphics::Gdi::ValidateRect, System::Com::*, + System::LibraryLoader::GetModuleHandleA, UI::WindowsAndMessaging::*, }; use windows::*; @@ -40,6 +40,9 @@ fn main() -> Result<()> { let initial_state = get_initial_state(); unsafe { + // Workaround for #37 + CoInitializeEx(std::ptr::null_mut(), COINIT_MULTITHREADED)?; + let instance = GetModuleHandleA(None); debug_assert!(instance.0 != 0);