Untitled
unknown
plain_text
21 days ago
2.2 kB
2
Indexable
use std::{thread, time::Duration}; use std::ptr::null_mut; use winapi::um::winuser::{FindWindowA, SendMessageA, WM_KEYDOWN, WM_KEYUP}; use winapi::um::winnt::LPCSTR; // Function to log key presses and actions fn log_event(action: &str, key: u32) { println!( "[{}] {}: Key code {}", chrono::Local::now().format("%Y-%m-%d %H:%M:%S"), action, key ); } // Function to send key inputs directly to a specified window fn send_key_to_window(key: u32, hwnd: *mut std::ffi::c_void, delay_ms: u64) { unsafe { // Log and send key down log_event("Pressing key", key); SendMessageA(hwnd, WM_KEYDOWN, key as usize, 0); // Delay to simulate holding the key thread::sleep(Duration::from_millis(50)); // Log and send key up log_event("Releasing key", key); SendMessageA(hwnd, WM_KEYUP, key as usize, 0); // Additional delay after key release thread::sleep(Duration::from_millis(delay_ms)); } } // Main function to execute the combo fn execute_combo(hwnd: *mut std::ffi::c_void) { println!("Starting combo execution..."); // Simulate combo steps send_key_to_window(0x57, hwnd, 300); // 'W' send_key_to_window(0x43, hwnd, 300); // 'C' send_key_to_window(0x10, hwnd, 800); // Shift send_key_to_window(0x46, hwnd, 600); // 'F' send_key_to_window(0x53, hwnd, 600); // 'S' send_key_to_window(0x45, hwnd, 700); // 'E' send_key_to_window(0x51, hwnd, 400); // 'Q' send_key_to_window(0x58, hwnd, 300); // 'X' } fn main() { // Find the BDO game window by its title unsafe { // Replace "BlackDesert64" with the exact window name for BDO let hwnd = FindWindowA(null_mut(), "BlackDesert64\0".as_ptr() as LPCSTR); if hwnd.is_null() { eprintln!("Error: Could not find BDO game window!"); return; } println!("Found game window! Ready to execute combo."); // Simulate holding middle mouse button to trigger the combo println!("Press the middle mouse button to execute the combo (emulated here)."); execute_combo(hwnd); } }
Editor is loading...
Leave a Comment