简体   繁体   English

Windows Forms 检测未插入时的按键

[英]Windows Forms Detecting Key Presses When Not Tabbed In

So i'm attempting to make an auto clicker for something, with a gui, im using .net framework for a windows forms project.因此,我正在尝试使用 gui 为某些东西制作自动点击器,我使用 .net 框架用于 windows forms 项目。 How ever i'm not sure how to set up a hot key for when the process isn't tabbed in.我怎么不知道如何为没有选项卡的过程设置热键。

    protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
    {
        if (keyData == (Keys.Control | Keys.F))
        {
            // Code
            return true;
        }
        return base.ProcessCmdKey(ref msg, keyData);
    }

is what i'm using, it correctly detects the key press when the gui is tabbed in how ever when it's tabbed out it doesn't work.是我正在使用的,它正确地检测到当 gui 被标记时的按键,但是当它被标记时它不起作用。

With windows forms how do you detect key presses when the app isn't tabbed in使用 windows forms 时,您如何在应用程序未选项卡时检测按键

From my knowledge there are only dirty solutions in C# for creating a hotkey: Recently I used this library for setting a global hotkey.据我所知,C# 中只有肮脏的解决方案来创建热键:最近我使用这个库来设置全局热键。

I hope I could manage to help you.我希望我能设法帮助你。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM