Skip to content

Commit 6410d50

Browse files
committed
fix(shell): native shell api calls failing
1 parent 6d9d061 commit 6410d50

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
### fix
1616

1717
- multiline tooltips.
18+
- show desktop not working.
1819

1920
## [2.5.9]
2021

src/background/windows_api/com.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ use windows::{
44
Win32::{
55
Foundation::RPC_E_CHANGED_MODE,
66
System::Com::{
7-
CoCreateInstance, CoInitializeEx, CoUninitialize, CLSCTX_ALL, COINIT_MULTITHREADED,
7+
CoCreateInstance, CoInitializeEx, CoUninitialize, CLSCTX_ALL, COINIT_APARTMENTTHREADED,
88
},
99
},
1010
};
1111

1212
pub struct Com {}
1313
impl Com {
14-
fn initialize() -> Result<ComGuard> {
15-
let hresult = unsafe { CoInitializeEx(None, COINIT_MULTITHREADED) };
14+
fn initialize(flags: windows::Win32::System::Com::COINIT) -> Result<ComGuard> {
15+
let hresult = unsafe { CoInitializeEx(None, flags) };
1616
if hresult.is_err() {
1717
if hresult == RPC_E_CHANGED_MODE {
1818
ComGuard { initialized: false };
@@ -34,7 +34,7 @@ impl Com {
3434
where
3535
F: FnOnce() -> Result<T>,
3636
{
37-
let _guard = Self::initialize()?;
37+
let _guard = Self::initialize(COINIT_APARTMENTTHREADED)?;
3838
f()
3939
}
4040
}

0 commit comments

Comments
 (0)