bug fixed

This commit is contained in:
crusader 2020-12-16 01:46:18 +09:00
parent 6e987477ba
commit 7cb3b5219f
2 changed files with 17 additions and 11 deletions

View File

@ -1,10 +1,13 @@
use std::ptr::null_mut;
use std::sync::atomic::{AtomicPtr, Ordering};
use std::{
mem::MaybeUninit,
ptr::null_mut,
sync::atomic::{AtomicPtr, Ordering},
};
use winapi::ctypes::c_int;
use winapi::shared::minwindef::{DWORD, HINSTANCE, LPARAM, LRESULT, WPARAM};
use winapi::shared::windef::HHOOK__;
use winapi::shared::windef::{HHOOK__, HWND};
use winapi::um::errhandlingapi::GetLastError;
use winapi::um::winuser::{SetWindowsHookExW, UnhookWindowsHookEx};
use winapi::um::winuser::{GetMessageW, SetWindowsHookExW, UnhookWindowsHookEx, MSG};
pub mod keyboard;
pub mod mouse;
@ -31,6 +34,9 @@ pub unsafe fn hook(
return Err(error);
}
let mut msg: MSG = MaybeUninit::zeroed().assume_init();
GetMessageW(&mut msg, 0 as HWND, 0, 0);
Ok(())
}

View File

@ -209,13 +209,13 @@ impl Robot {
_ => None,
}
}
// WM_MOUSEMOVE => {
// let (x, y) = Self::get_mouse_point(l_param);
// Some(EventType::MouseMoveTo {
// x: x as f64,
// y: y as f64,
// })
// }
WM_MOUSEMOVE => {
let (x, y) = Self::get_mouse_point(l_param);
Some(EventType::MouseMoveTo {
x: x as f64,
y: y as f64,
})
}
_ => None,
};