You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Diagnostics;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace HighWayIot.Common
|
|
|
|
|
{
|
|
|
|
|
public class OSKHelper
|
|
|
|
|
{
|
|
|
|
|
#region 打开软盘
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 打开软盘
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static void OpenOsk()
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
Process proc = new Process();
|
|
|
|
|
proc.StartInfo.FileName = @"C:\Windows\System32\osk.exe";
|
|
|
|
|
proc.StartInfo.UseShellExecute = true;
|
|
|
|
|
proc.StartInfo.Verb = "runas";
|
|
|
|
|
proc.Start();
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 关闭软盘
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 关闭软盘
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static void CloseOsk()
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
// 查找并关闭 osk.exe 进程
|
|
|
|
|
foreach (Process proc in Process.GetProcessesByName("osk"))
|
|
|
|
|
{
|
|
|
|
|
proc.Kill();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
// 可以在这里处理异常情况
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|