Last active
March 4, 2017 15:38
-
-
Save nkjzm/092fb07d24ddd049980f3fd1e7210a16 to your computer and use it in GitHub Desktop.
UnityからWindowsデスクトップアプリの仮想キーボードを呼び出すためのプログラム
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Diagnostics; | |
using System.Runtime.InteropServices; | |
namespace WindowsTouchScreen | |
{ | |
public static class Keyboard | |
{ | |
static int WM_SYSCOMMAND = 0x0112; | |
static int SC_CLOSE = 0xF060; | |
[DllImport("user32.dll")] | |
static extern IntPtr FindWindow(string lpClassName, string lpWindowName); | |
[DllImport("user32.dll")] | |
static extern int SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam); | |
public static void Open() | |
{ | |
Process.Start(@"C:\Program Files\Common Files\microsoft shared\ink\TabTip.exe"); | |
} | |
public static void Close() | |
{ | |
var hWnd = FindWindow("IPTip_Main_Window", ""); | |
if (hWnd != null) | |
{ | |
SendMessage(hWnd, WM_SYSCOMMAND, SC_CLOSE, 0); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment