question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Not possible to run on Console

See original GitHub issue

Hey,

I Tried to install a hook from a Console and simply nothing happens.

                _keyListener = new KeyboardHookListener(new GlobalHooker());
                _keyListener.Enabled = true;
                _keyListener.KeyPress += KeyListenerOnKeyPress;

the event is never invoked. Could you please add support for Non Windows Forms/WPF Applications?

regards

Issue Analytics

  • State:open
  • Created 8 years ago
  • Reactions:3
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

15reactions
tofutimcommented, Jul 6, 2016

In case anyone runs into this, here is a sample that works

class Program
{
    static IKeyboardMouseEvents _hook;

    static void Main(string[] args)
    {
        ApplicationContext msgLoop = new ApplicationContext();

        _hook = Hook.GlobalEvents();
        _hook.KeyDown += _hook_KeyDown;

        Application.Run(msgLoop);
    }

    private static void _hook_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
    {
        Console.WriteLine("key {0}", e.KeyCode);

        if (e.KeyCode == Keys.X)
        {
            Application.Exit();
        }
    }
}
0reactions
ihorbondcommented, Apr 24, 2020

@tofutim have you by any chance tried to make this work with background service ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

why can't console games be ran natively? : r/emulation
I understand older consoles are on entirely different architectures that function far differently then modern PCs but why not newer consoles?
Read more >
Why does my PyCharm console not run my function?
First, edit your file name, removing any space, e.g., jogo_do_galo.py (or another name, like jogo_do_mengao). Open the python console, and try:
Read more >
Console not working - Unit and Lesson Discussion
I have a student making a simulated store in the console. When the game is run at full speed, the console doesn't update...
Read more >
Console not working : Forums
Console not working. The message I get is "Loading console ..." I'm on Mac OS X Mountain Lion trying it with latest versions...
Read more >
Console not working, any ideas?
Answer 51412a0bce4a7ea59d001c27​​ If this is in relation to 'Run' not working, then type your code and click 'Save'. Then refresh the page and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found