using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.InteropServices;
using System.Diagnostics;
using System.Windows.Forms;
using NLog; namespace Utils.common
{
class ScreenKeyboard
{
private static ILogger logger = NLog.LogManager.GetCurrentClassLogger();
public static bool isShowNumBoard = false; [DllImport("kernel32.dll", SetLastError = true)]
public static extern bool Wow64DisableWow64FsRedirection(ref IntPtr ptr); [DllImport("kernel32.dll", SetLastError = true)]
public static extern bool Wow64RevertWow64FsRedirection(IntPtr ptr); public static IntPtr ptr = new IntPtr(); public static void ShowScreenKeyboard()
{
try {
//判断软键盘是否进程是否已经存在,如果不存在进行调用
Process[] pro = Process.GetProcessesByName("osk");
bool isWow64FsRedirectionDisabled = Wow64DisableWow64FsRedirection(ref ptr); //键盘如果已经打开则重新打开,防止最小化无法显示
if (pro != null && pro.Length > 0)
{
Process kbpr = pro[0];
kbpr.Kill();
if (isWow64FsRedirectionDisabled)
{
Process.Start(@"C:\WINDOWS\system32\osk.exe");
Wow64RevertWow64FsRedirection(ptr);
}
return;
}
if (isWow64FsRedirectionDisabled)
{
Process.Start(@"C:\WINDOWS\system32\osk.exe");
Wow64RevertWow64FsRedirection(ptr);
}
}
catch (Exception ex)
{
logger.Error(ex.Message);
}
} }
}

  

最新文章

  1. MD5加密操作
  2. Amoeba For MySQL读写分离
  3. SSM框架学习之高并发秒杀业务--笔记3-- Service层
  4. ssh和mvc理论基础
  5. Google 开发新的开源系统 Fuchsia
  6. 《转》---使用递归方法DataTable 绑定 TreeView
  7. OpenGL函数解析之gluPerspective()
  8. Mac上安装Tomcat服务器
  9. 三大文本处理工具grep、sed及awk的简单介绍
  10. artDialog.js的使用
  11. Cocos2d-x 3.0rc0版本号项目的创建和部署
  12. CentOS下Denyhosts的安装和使用
  13. git 如何删除已经add的文件
  14. Codeforces 984 D - XOR-pyramid
  15. ORM框架(ITDOS实战源码)
  16. Qt5+VS2010的安装及使用
  17. 8个提高效率的CSS实用工具
  18. TCP数据传输过程详解
  19. 【POJ】【3525】Most Distant Point from the Sea
  20. 【bzoj4998】星球联盟(并查集+边双)

热门文章

  1. Decompiling XAPK Files
  2. mysql8.0.30主从配置
  3. No.3.1
  4. element的表格组件label宽度设置
  5. HP DC7800 升级CPU出现:Missing or Invalid Processor Microcode Update —— 解决方案:更新主板BIOS
  6. ant design vue datePicker 日期时间范围设置默认为当天0点-23点59
  7. 设置点击事件时Unable to preventDefault inside passive event listener due to target being treated as passive
  8. [UnityShader]说厌了的遮挡显示
  9. promethues【centos7】时间同步
  10. angular js 实现模糊查询并分页