Skip to content

Commit

Permalink
tests and samples
Browse files Browse the repository at this point in the history
  • Loading branch information
kennykerr committed Jan 19, 2024
1 parent c3f5af4 commit c0bdc32
Show file tree
Hide file tree
Showing 13 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions crates/samples/windows-sys/task_dialog/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ fn main() {
}
}

extern "system" fn callback(_: HWND, notification: u32, _: WPARAM, _: LPARAM, _: isize) -> HRESULT {
if notification == TDN_BUTTON_CLICKED as _ {
extern "system" fn callback(_: HWND, notification: i32, _: WPARAM, _: LPARAM, _: isize) -> HRESULT {
if notification == TDN_BUTTON_CLICKED {
println!("button clicked");
}

Expand Down
2 changes: 1 addition & 1 deletion crates/samples/windows/bits/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use windows::{

fn main() -> Result<()> {
unsafe {
CoInitializeEx(None, COINIT_MULTITHREADED)?;
CoInitializeEx(None, COINIT_MULTITHREADED).ok()?;

let manager: IBackgroundCopyManager =
CoCreateInstance(&BackgroundCopyManager, None, CLSCTX_LOCAL_SERVER)?;
Expand Down
2 changes: 1 addition & 1 deletion crates/samples/windows/core_app/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ impl IFrameworkView_Impl for CoreAppView {

fn main() -> Result<()> {
unsafe {
CoInitializeEx(None, COINIT_MULTITHREADED)?;
CoInitializeEx(None, COINIT_MULTITHREADED).ok()?;

if let Err(result) = Package::Current() {
MessageBoxW(
Expand Down
2 changes: 1 addition & 1 deletion crates/samples/windows/dcomp/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const WINDOW_HEIGHT: f32 = CARD_ROWS as f32 * (CARD_HEIGHT + CARD_MARGIN) + CARD

fn main() -> Result<()> {
unsafe {
CoInitializeEx(None, COINIT_MULTITHREADED)?;
CoInitializeEx(None, COINIT_MULTITHREADED).ok()?;
SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2)?;
}
let mut window = Window::new()?;
Expand Down
2 changes: 1 addition & 1 deletion crates/samples/windows/direct2d/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use windows::{

fn main() -> Result<()> {
unsafe {
CoInitializeEx(None, COINIT_MULTITHREADED)?;
CoInitializeEx(None, COINIT_MULTITHREADED).ok()?;
}
let mut window = Window::new()?;
window.run()
Expand Down
2 changes: 1 addition & 1 deletion crates/samples/windows/shell/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use windows::{
};

fn main() -> Result<()> {
unsafe { CoInitialize(None)? };
unsafe { CoInitialize(None).ok()? };

shell_execute_from_explorer(
"https://github.com/microsoft/windows-rs",
Expand Down
2 changes: 1 addition & 1 deletion crates/samples/windows/spellchecker/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ fn main() -> Result<()> {
.expect("Expected one command line argument for text to be spell-corrected");
// Initialize the COM runtime for this thread
unsafe {
CoInitializeEx(None, COINIT_MULTITHREADED)?;
CoInitializeEx(None, COINIT_MULTITHREADED).ok()?;
}

// Create ISpellCheckerFactory
Expand Down
4 changes: 2 additions & 2 deletions crates/samples/windows/task_dialog/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ fn main() -> Result<()> {
}
}

extern "system" fn callback(_: HWND, notification: u32, _: WPARAM, _: LPARAM, _: isize) -> HRESULT {
if notification == TDN_BUTTON_CLICKED.0 as _ {
extern "system" fn callback(_: HWND, notification: TASKDIALOG_NOTIFICATIONS, _: WPARAM, _: LPARAM, _: isize) -> HRESULT {
if notification == TDN_BUTTON_CLICKED {
println!("button clicked");
}

Expand Down
2 changes: 1 addition & 1 deletion crates/samples/windows/uiautomation/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use windows::{

fn main() -> Result<()> {
unsafe {
CoInitializeEx(None, COINIT_MULTITHREADED)?;
CoInitializeEx(None, COINIT_MULTITHREADED).ok()?;
let window = FindWindowA(None, s!("Calculator"));

// Start with COM API
Expand Down
2 changes: 1 addition & 1 deletion crates/samples/windows/wmi/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use windows::{core::*, Win32::System::Com::*, Win32::System::Wmi::*};

fn main() -> Result<()> {
unsafe {
CoInitializeEx(None, COINIT_MULTITHREADED)?;
CoInitializeEx(None, COINIT_MULTITHREADED).ok()?;

CoInitializeSecurity(
None,
Expand Down
2 changes: 1 addition & 1 deletion crates/tests/array/tests/com.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use windows::{core::*, Win32::Media::MediaFoundation::*, Win32::System::Com::*};
#[test]
fn test() -> Result<()> {
unsafe {
CoInitializeEx(None, COINIT_MULTITHREADED)?;
CoInitializeEx(None, COINIT_MULTITHREADED).ok()?;

let mut data = std::ptr::null_mut();
let mut len = 0;
Expand Down
2 changes: 1 addition & 1 deletion crates/tests/interface/tests/non_com_existing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ impl IXAudio2VoiceCallback_Impl for Callback {
#[test]
fn test() -> Result<()> {
unsafe {
CoInitializeEx(None, COINIT_MULTITHREADED)?;
CoInitializeEx(None, COINIT_MULTITHREADED).ok()?;

let reflection = ID3D12FunctionParameterReflection::new(&Reflection);
let mut desc = Default::default();
Expand Down
2 changes: 1 addition & 1 deletion crates/tests/interop/tests/activate_instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use windows::{
// activate WinRT types directly as it can do so far more efficiently.
#[test]
fn test() -> Result<()> {
unsafe { CoInitializeEx(None, COINIT_MULTITHREADED)? };
unsafe { CoInitializeEx(None, COINIT_MULTITHREADED).ok()? };

let instance: HSTRING = "Windows.Foundation.Collections.StringMap".into();
let instance = unsafe { RoActivateInstance(&instance)? };
Expand Down

0 comments on commit c0bdc32

Please sign in to comment.