模拟键盘操作Windows应用程序

简介: 这是针对Windows系统录音软件的小程序 目的是把声音文件的频率转换的低一些 尝试过用WINDOWS API来做这个事,结果失败了 最后还是用程序操作EXE文件完成工作的   代码 using System;using System.

这是针对Windows系统录音软件的小程序

目的是把声音文件的频率转换的低一些

尝试过用WINDOWS API来做这个事,结果失败了

最后还是用程序操作EXE文件完成工作的

 

img_1c53668bcee393edac0d7b3b3daff1ae.gif img_405b18b4b6584ae338e0f6ecaf736533.gif 代码
 
  
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Diagnostics;
using System.Threading;

namespace ShengYin2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
folderBrowserDialog1.ShowNewFolderButton
= false ;
}

private void button1_Click( object sender, EventArgs e)
{
DialogResult dr
= folderBrowserDialog1.ShowDialog();
if (dr == DialogResult.OK)
{
label1.Text
= " 路径: " + folderBrowserDialog1.SelectedPath;
}
}

private void button2_Click( object sender, EventArgs e)
{
Process myProc
= new Process();
myProc.StartInfo.FileName
= @" C:\wINDOWS\system32\sndrec32.exe " ;
myProc.StartInfo.UseShellExecute
= false ;
myProc.StartInfo.RedirectStandardInput
= true ;
myProc.Start();
DirectoryInfo di
= new DirectoryInfo(folderBrowserDialog1.SelectedPath);
FileInfo[] fis
= di.GetFiles();
foreach (var a in fis)
{
if (a.Extension.Contains( " wav " ))
{
Thread.Sleep(
600 );
SendKeys.SendWait(
" %f " );
Thread.Sleep(
600 );
SendKeys.SendWait(
" o " );
Thread.Sleep(
600 );
SendKeys.SendWait(a.FullName);
Thread.Sleep(
600 );
SendKeys.SendWait(
" {Enter} " );
Thread.Sleep(
600 );
SendKeys.SendWait(
" %f " );
Thread.Sleep(
600 );
SendKeys.SendWait(
" a " );
Thread.Sleep(
600 );
SendKeys.SendWait(
" %c " );
Thread.Sleep(
600 );
SendKeys.SendWait(
" {Down} " );
Thread.Sleep(
600 );
SendKeys.SendWait(
" {Down} " );
Thread.Sleep(
600 );
SendKeys.SendWait(
" {Enter} " );
Thread.Sleep(
600 );
SendKeys.SendWait(
" {Enter} " );
Thread.Sleep(
600 );
SendKeys.SendWait(
" {Enter} " );
}
}
myProc.Close();
MessageBox.Show(
" 转换完成 " );
}
}
}

 

目录
相关文章
|
12月前
|
安全 Ubuntu iOS开发
Nessus Professional 10.10 Auto Installer for Windows - Nessus 自动化安装程序
Nessus Professional 10.10 Auto Installer for Windows - Nessus 自动化安装程序
366 3
Nessus Professional 10.10 Auto Installer for Windows - Nessus 自动化安装程序
|
安全 测试技术 Linux
Flawnter 5.9.1 (macOS, Linux, Windows) - 应用程序安全测试软件
Flawnter 5.9.1 (macOS, Linux, Windows) - 应用程序安全测试软件
509 2
Flawnter 5.9.1 (macOS, Linux, Windows) - 应用程序安全测试软件
|
Windows
Windows下版本控制器(SVN)-验证是否安装成功+配置版本库+启动服务器端程序
Windows下版本控制器(SVN)-验证是否安装成功+配置版本库+启动服务器端程序
395 2
|
Windows
Windows下版本控制器(SVN)-启动服务器端程序
Windows下版本控制器(SVN)-启动服务器端程序
750 4
|
Ubuntu Linux Windows
如何在Ubuntu系统中安装Wine,借此来运行Windows程序
熟悉的登录画面出现,在Ubuntu系统中扫描登录微信程序。
|
Unix Linux 编译器
解决在Windows平台上运行Golang程序时出现的syscall.SIGUSR1未定义错误。
通过这种结构,你的代码既可以在支持 SIGUSR1 信号的系统上正常工作,又可以在不支持这些信号的 Windows 系统上编译通过,确保跨平台的兼容性和功能的完整性。
448 0
|
安全 Devops 测试技术
AppSpider 7.5.018 for Windows - Web 应用程序安全测试
AppSpider 7.5.018 for Windows - Web 应用程序安全测试
316 0
AppSpider 7.5.018 for Windows - Web 应用程序安全测试
|
安全 JavaScript Java
AppSpider Pro 7.5.015 for Windows - Web 应用程序安全测试
AppSpider Pro 7.5.015 for Windows - Web 应用程序安全测试
335 12
AppSpider Pro 7.5.015 for Windows - Web 应用程序安全测试
|
存储 监控 安全
如何排查常见的 Windows 应用程序错误和崩溃
本文介绍了如何通过事件日志分析来诊断Windows应用程序错误和崩溃的根本原因。文章首先解释了应用错误的表现形式及常见事件ID(如1000、1001等),并分析了导致崩溃的原因,包括硬件问题(如存储不足、外部因素)和软件问题(如编码错误、数据损坏、.NET Framework兼容性)。接着,提供了几种故障排除方法,例如运行系统文件检查器(SFC)、执行干净启动、检查更新以及重新安装.NET Framework。最后,探讨了使用日志管理工具(如EventLog Analyzer)集中分析崩溃事件的功能,包括预置报表、时间轴分析、实时警报和自动化响应,帮助管理员高效解决应用问题。
3111 1
|
Windows
Windows程序的数字签名证书怎么申请
Windows程序的数字签名证书申请流程包括:准备企业资料(营业执照、税务登记证等),提交申请表及企业资料。经过初审、实名认证和二审后,等待1-5个工作日审核结果。审核通过后,CA机构颁发证书并通过邮件或邮寄方式发送。收到证书后按指南安装并使用签名工具对程序进行数字签名,确保软件完整性和可信度。注意证书有效期、管理和兼容性问题。