如何使用发送键向应用程序发送Ctrl + Shift + F1 [英] How to Send Ctrl+Shift+F1 to an application using send keys

查看:70
本文介绍了如何使用发送键向应用程序发送Ctrl + Shift + F1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将 Ctrl + Shift + F1 组合键发送到应用程序.

I want to send Ctrl+Shift+F1 combination of keys to an application.

但是当我尝试发送密钥时,出现错误,错误是 ^ + F1 不是有效的密钥.

But when I try to send the keys i am getting an error,the error is, ^+F1 is not a valid key.

我正在使用的代码是:

System.Windows.Forms.SendKeys.Send("{^+F1}");

推荐答案

查看

Looking at the documentation you need to have your braces around just the F1. Try this to see if it works

System.Windows.Forms.SendKeys.Send("^+{F1}");

在上面的链接中,将要发送文字字符的括号和^和+括起来.

From above link by enclosing the ^ and + in the braces you are sending the literal character.

加号(+),脱字号(^),百分号(%),波浪号(〜)和括号()对SendKeys具有特殊含义.要指定这些字符之一,请将其括在大括号({})

The plus sign (+), caret (^), percent sign (%), tilde (~), and parentheses () have special meanings to SendKeys. To specify one of these characters, enclose it within braces ({})

由barlop添加-解释性注释-

(来自上面的文档链接)

(from the documentation link above)

SHIFT +
CTRL ^
ALT %

F1 {F1}
F2 {F2}

这篇关于如何使用发送键向应用程序发送Ctrl + Shift + F1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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