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

View File

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