支持Win10x64、Win7x32、x64,其他没有测试
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.IO;
/*
* 注意:AnyCPU编译,取消勾选首选32位
Win10
app 64 + + + S3
Win7x32
app 86 + + + S3
Win7x64
app 64 + + + S3
*/
namespace OpenOSKApp
{
class Program
{
static void Main(string[] args)
{
try
{
Console.WriteLine($"OS:{(Environment.Is64BitOperatingSystem ? "x64" : "x86")}");
Console.WriteLine($"App:{(Environment.Is64BitProcess ? "x64" : "x86")}");
var path = @"C:WindowsSystem32osk.exe";
if (!Environment.Is64BitOperatingSystem)
{
Process proc = new Process();
proc.StartInfo.FileName = path;
proc.Start();
return;
}
{
if (File.Exists(path))
{
Process.Start(path);
}
else
{
throw new Exception($"虚拟键盘不存在,请安装正版操作系统!查找路径:{path}");
}
}
}
catch (Exception ex)
{
Console.WriteLine(ex + "");
Console.Read();
}
System.Threading.Thread.Sleep(1500);
}
}
}
如果安装有360或金山全家桶的,先退出全家桶再试