The words Under construction in black text on a yellow background with diagonal black stipes surrounding it
I'm in the process of moving my site. It's still a work in progress. Please excuse the mess and broken links.

Setting Up A Keylogger In Rust

TODO: Pull subtitle into page object
Code
use device_query::{DeviceEvents, DeviceState};
fn main() {
    let device_state = DeviceState::new();

    let _guard = device_state.on_mouse_move(|position| {
        println!("Mouse position: {:#?}", position);
    });
    let _guard = device_state.on_mouse_down(|button| {
        println!("Mouse button down: {:#?}", button);
    });
    let _guard = device_state.on_mouse_up(|button| {
        println!("Mouse button up: {:#?}", button);
    });
    let _guard = device_state.on_key_down(|key| {
        println!("Keyboard key down: {:#?}", key);
    });
    let _guard = device_state.on_key_up(|key| {
        println!("Keyboard key up: {:#?}", key);
    });

    loop {}
}

Debugging Stuff

I'm moving stuff around right now. All this below is helping me figure out where to put stuff

        -- title

Setting Up A Keylogger In Rust

This does mouse and keyboard

This is straight from the home page example:

-- code
-- rust

use device_query::{DeviceEvents, DeviceState};
fn main() {
    let device_state = DeviceState::new();

    let _guard = device_state.on_mouse_move(|position| {
        println!("Mouse position: {:#?}", position);
    });
    let _guard = device_state.on_mouse_down(|button| {
        println!("Mouse button down: {:#?}", button);
    });
    let _guard = device_state.on_mouse_up(|button| {
        println!("Mouse button up: {:#?}", button);
    });
    let _guard = device_state.on_key_down(|key| {
        println!("Keyboard key down: {:#?}", key);
    });
    let _guard = device_state.on_key_up(|key| {
        println!("Keyboard key up: {:#?}", key);
    });

    loop {}
}


-- ref
-- url: https://docs.rs/device_query/latest/device_query/

-- ref
-- url: https://crates.io/crates/device_query

-- categories
-- Rust 

-- metadata
-- date: 2023-07-29 15:14:05
-- id: 2tg8r59m
-- site: aws
-- type: post
-- status: scratch