rodrigocfd / winsafe

Windows API and GUI in safe, idiomatic Rust.
https://crates.io/crates/winsafe
MIT License
520 stars 30 forks source link

[BUG?QUESTION?]SendInput example not working #94

Closed anatawa12 closed 1 year ago

anatawa12 commented 1 year ago

This will result [0x0078 120] This function is not supported on this system. What's wrong?

fn main() {
    use winsafe::prelude::*;
    use winsafe::{co, HwKbMouse, KEYBDINPUT, SendInput};

    SendInput(&[
        HwKbMouse::Kb(
            KEYBDINPUT {
                wVk: co::VK::LWIN,
                ..Default::default()
            },
        ),
        HwKbMouse::Kb(
            KEYBDINPUT {
                wVk: co::VK::CHAR_D,
                ..Default::default()
            },
        ),
        HwKbMouse::Kb(
            KEYBDINPUT {
                wVk: co::VK::CHAR_D,
                dwFlags: co::KEYEVENTF::KEYUP,
                ..Default::default()
            },
        ),
        HwKbMouse::Kb(
            KEYBDINPUT {
                wVk: co::VK::LWIN,
                dwFlags: co::KEYEVENTF::KEYUP,
                ..Default::default()
            },
        ),
    ]).unwrap();
}
rodrigocfd commented 1 year ago

Unlikely to be a bug, probably this: https://stackoverflow.com/q/65871825/6923555