zoukankan      html  css  js  c++  java
  • .net调用系统软键盘(兼容win7及win10)

    没有什么技术说明,也是查询出来的,在此做记录

    public class StartKeyBoard
        {
            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 void StartKeyBoardFun()
            {
                string path = "C:/Program Files/Common Files/microsoft shared/ink/TabTip.exe";
                if (File.Exists(path))
                {
                    Process p = Process.Start(path);
                }
                else
                {
                    //判断软键盘是否进程是否已经存在,如果不存在进行调用
                    Process[] pro = Process.GetProcessesByName("osk");
                    //说明已经存在,不再进行调用
                    if (pro != null && pro.Length > 0)
                        return;
                    IntPtr ptr = new IntPtr();
                    bool isWow64FsRedirectionDisabled = Wow64DisableWow64FsRedirection(ref ptr);
                    if (isWow64FsRedirectionDisabled)
                    {
                        Process.Start(@"C:WINDOWSsystem32osk.exe");
                        bool isWow64FsRedirectionReverted = Wow64RevertWow64FsRedirection(ptr);
                    }
                }
            }

        }

  • 相关阅读:
    并发和多线程(二)--启动和中断线程(Interrupt)的正确姿势
    并发和多线程(一)--创建线程的方式
    MySQL系列(十二)--如何设计一个关系型数据库(基本思路)
    Elasticsearch系列(二)--query、filter、aggregations
    Spark-python入门
    python中的Turtle模块
    pytorch显示网络结构
    风格迁移(2)-Fast Style Transfer
    风格迁移(1)-格拉姆矩阵
    使用GAN生成图片
  • 原文地址:https://www.cnblogs.com/ljs0322/p/8037555.html
Copyright © 2011-2022 走看看