Skip to content

Commit

Permalink
Add workaround for #37
Browse files Browse the repository at this point in the history
  • Loading branch information
mwcampbell committed Sep 28, 2021
1 parent bbf9ccd commit 48791cb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions platforms/windows/bindings/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ fn main() {
Foundation::*,
Graphics::Gdi::ValidateRect,
System::{
Com::CoInitializeEx,
LibraryLoader::GetModuleHandleA,
OleAutomation::*,
},
Expand Down
7 changes: 5 additions & 2 deletions platforms/windows/examples/hello_world.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::*;

Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit 48791cb

Please sign in to comment.