Alt+F,S 在 sendKeys C# 中不起作用

0 c# simulate sendkeys

我想保存并关闭打开的各种应用程序。具体的应用程序是通过处理命令来识别的。有了这个我就可以杀死它。

为了保存,我尝试了 SendKeys 类,首先我设置了 SetForegroundWindow(h),并通过使用 ctrl+成功s

SendKeys.Send("^s"); //Ctrl+s
Run Code Online (Sandbox Code Playgroud)

但是,用户定义的应用程序在那里,而且我也有一个情况来保存一个新的(不存在的文件),它必须由Alt+ F+S保存。以便它以默认名称保存我如何实现这一目标,我尝试过,

SendKeys.Send("%(fs)");
SendKeys.Send("%f"+"s"); //Alt+F 
SendKeys.Send("%f" + "%s)"); //Alt+F
SendKeys.Send("%fs"); 
Run Code Online (Sandbox Code Playgroud)

请指导我,如果 SendKeys 无法实现,我还应该尝试什么。

C0d*_*mer 5

始终使用中断,可以避免错误。

SendKeys.Send("%{f}"); //Alt+F
SendKeys.Send("{A}"); //A
Run Code Online (Sandbox Code Playgroud)

或尝试

SendKeys.Send("%{f}{A}"); //Alt+F And A
Run Code Online (Sandbox Code Playgroud)