zoukankan      html  css  js  c++  java
  • C# 调用Win8系统键盘

    private const Int32 WM_SYSCOMMAND = 274;
    private const UInt32 SC_CLOSE = 61536;
    [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
    private static extern bool PostMessage(IntPtr hWnd, int Msg, int wParam, int lParam);
    [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
    private static extern bool PostMessage(IntPtr hWnd, int Msg, uint wParam, uint lParam);
    [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
    private static extern bool PostMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);
    [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
    private static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
    [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
    private static extern int RegisterWindowMessage(string lpString);

    //显示屏幕键盘
    public static int ShowInputPanel()
    {
    try
    {
    dynamic file = "C:\Program Files\Common Files\microsoft shared\ink\TabTip.exe";
    if (!System.IO.File.Exists(file))
    return -1;
    Process.Start(file);
    return SetUnDock();
    }
    catch (Exception)
    {
    return 255;
    }
    }

    //隐藏屏幕键盘
    public static void HideInputPanel()
    {
    IntPtr TouchhWnd = new IntPtr(0);
    TouchhWnd = FindWindow("IPTip_Main_Window", null);
    if (TouchhWnd == IntPtr.Zero)
    return;
    PostMessage(TouchhWnd, WM_SYSCOMMAND, SC_CLOSE, 0);
    }
  • 相关阅读:
    网页支付宝接口使用
    @Valid注解的使用springmvc pojo校验
    Git
    面试宝典
    Navicat 破解版(操作非常简单)
    JAVA中List,Map,Set接口的区别
    java 枚举示例
    springcloud和springboot是什么关系?
    java面试经常涉及到的
    asp.net 报错 SAP 报错 试图加载格式不正确的程序。 (异常来自 HRESULT:0x8007000B)
  • 原文地址:https://www.cnblogs.com/qizh/p/3670378.html
Copyright © 2011-2022 走看看