Reply to thread

rsenden: I read the link provided above and someone said this:




Code how it was done:

[collapse]

void SomeMethod()

{

    KeyboardHook hook = new KeyboardHook("Override minimize all");

 

    string errorMessage;

    if (!hook.TrySetKeys(EnhancedKeys.WinLogo | EnhancedKeys.M, out errorMessage))

    {

        // If another hook already owns these keys, you will get an error here.

        MessageBox.Show(errorMessage);

        return;

    }

 

    // Instead of minimizing all windows, WinLogo + M will now display

    // this messagebox.

    hook.Pressed += (s, e) =>

        {

            MessageBox.Show("Pressed!");

        };

 

        // Activate the hook.

    hook.Engage();

 

    // Sometime later...

 

    // By default, the hook will only allow its Pressed event(s) to execute. To

    // allow additional processing, set this property to true. In this example, setting

    // AllowPassThrough to true will (1) display a message box and (2) minimize all windows.

    hook.AllowPassThrough = true;

 

    // By default, the hook's Pressed event(s) will only execute once per key press. To

    // continuously execute these events while the key is held down, set this to true.

    hook.AutoRepeat = true;

 

    // Disengage to temporarily disconnect the hook from the system. To re-activate,

    // call Engage() again.

    hook.Disengage();

 

    // Kills off the hook. Don't forget to call Dispose or the hook's keys will remain

    // unavailable until after its finalizer has executed. Dispose() calls Disengage() so

    // it is not necessary to call both.

    hook.Dispose();

 

    // Most of the rest is just informational

    Console.WriteLine("Is alt key used: " + hook.Alt);

    Console.WriteLine("Is shift key used: " + hook.Shift);

    Console.WriteLine("Is win logo key used: " + hook.Windows);

    Console.WriteLine("Is control key used: " + hook.Control);

    Console.WriteLine("Current keys: " + hook.Keys);

    Console.WriteLine("Current unmodified key: " + hook.UnmodifiedKey);

    Console.WriteLine("Is hook active: " + hook.IsEngaged);

    Console.WriteLine("Hook has no keys assigned: " + hook.IsEmpty);

}

[/collapse]



Would that be possible?


Top Bottom