Win8 환경 WPF 소프트 키보드 켜기 및 끄기

5101 단어 win8
코드는 다음과 같습니다.
public class KeyBoardHelper
    {
        #region     
        /// <summary>
        ///     
        /// </summary>
        public static void ShowInputPanel()
        {
            string path = @"C:\Program Files\Common Files\microsoft shared\ink\TabTip.exe";
            string path32 = @"C:\Program Files (x86)\Common Files\Microsoft Shared\Ink\TabTip32.exe";
            if (File.Exists(path))
            {
                Process.Start(path);
            }
            else if (File.Exists(path32))
            {
                Process.Start(path32);
            }
        }

        #region import    
         [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
        private static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
        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, uint wParam, uint lParam);
        #endregion
       /// <summary>
        ///        
       /// </summary>
        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);
        }
        #endregion 
    }

좋은 웹페이지 즐겨찾기