如何在 C# 中执行按住 ALT+TAB 发送键事件 [英] how to perform a hold ALT+TAB sendkey event in C#

查看:91
本文介绍了如何在 C# 中执行按住 ALT+TAB 发送键事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用一个 sendkey 事件,该事件持有 ALT 键,然后按 TAB 键.您如何执行该操作,我尝试了很多变体,但似乎找不到答案,谢谢.

I am trying to use a sendkey event that holds the ALT key and then presses the TAB key. How do you perform that action, I've tried many variations but I can't seem to find the answer, thanks.

推荐答案

使用 sendkeys PInvoke 可以通过发送 ALT keydown 事件,TAB keydown,然后 TAB keyup,然后 ALT keyup 来做到这一点.还有另一种在键上使用 ALT 修饰符的方法,但我不记得确切的方式,因为我有一段时间没有使用它了.

Using sendkeys PInvoke it's possible to do this by sending ALT keydown event, TAB keydown, then TAB keyup, then ALT keyup. There is also another way using the ALT modifier on the key but I cannot remember exactly how as I haven't worked with it in a while.

如果您想在保持 ALT 为 keydown 的同时交替使用 TAB 键和键.

If you want to do multiple tabs alternate the TAB keydown and keyup while keeping the ALT on keydown.

这篇关于如何在 C# 中执行按住 ALT+TAB 发送键事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆